From 6a2341519e6f9f74683370ae2a2d63e27681f72c Mon Sep 17 00:00:00 2001 From: naveena-maplelabs Date: Thu, 11 Jan 2024 20:05:00 -0800 Subject: [PATCH] Updated version 1.1.7 --- galaxy.yml | 2 +- plugins/module_utils/cohesity_auth.py | 2 +- plugins/module_utils/cohesity_hints.py | 8 +- plugins/module_utils/cohesity_utilities.py | 2 +- plugins/modules/cohesity_agent.py | 10 +- plugins/modules/cohesity_cancel_migration.py | 6 +- plugins/modules/cohesity_clone_vm.py | 4 +- plugins/modules/cohesity_facts.py | 2 +- .../modules/cohesity_finalize_migration.py | 4 +- plugins/modules/cohesity_job.py | 20 +- plugins/modules/cohesity_migrate_vm.py | 26 +- plugins/modules/cohesity_migration_status.py | 6 +- plugins/modules/cohesity_oracle_job.py | 2 +- plugins/modules/cohesity_oracle_restore.py | 2 +- plugins/modules/cohesity_oracle_source.py | 2 +- plugins/modules/cohesity_plugin.py | 6 +- plugins/modules/cohesity_policy.py | 4 +- plugins/modules/cohesity_restore_file.py | 6 +- plugins/modules/cohesity_restore_vm.py | 12 +- .../modules/cohesity_restore_vmware_file.py | 8 +- plugins/modules/cohesity_source.py | 8 +- plugins/modules/cohesity_storage_domain.py | 282 ------------------ plugins/modules/cohesity_sync_objects.py | 4 +- .../modules/cohesity_uda_protection_group.py | 4 +- plugins/modules/cohesity_uda_source.py | 4 +- plugins/modules/cohesity_view.py | 4 +- plugins/modules/cohesity_win_agent.py | 2 +- 27 files changed, 81 insertions(+), 361 deletions(-) delete mode 100644 plugins/modules/cohesity_storage_domain.py diff --git a/galaxy.yml b/galaxy.yml index ced88d1..eacb3f9 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: cohesity name: dataprotect # The version of the collection. Must be compatible with semantic versioning -version: 1.1.6 +version: 1.1.7 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/plugins/module_utils/cohesity_auth.py b/plugins/module_utils/cohesity_auth.py index ea937ae..b1de731 100644 --- a/plugins/module_utils/cohesity_auth.py +++ b/plugins/module_utils/cohesity_auth.py @@ -13,7 +13,7 @@ module_utils: cohesity_auth short_description: The **CohesityAuth** utils module provides the authentication token manage for Cohesity Platforms. -version_added: 1.1.6 +version_added: 1.1.7 description: - The **CohesityAuth** utils module provides the authentication token manage for Cohesity Platforms. diff --git a/plugins/module_utils/cohesity_hints.py b/plugins/module_utils/cohesity_hints.py index 0a03f38..b84cb6c 100644 --- a/plugins/module_utils/cohesity_hints.py +++ b/plugins/module_utils/cohesity_hints.py @@ -14,7 +14,7 @@ module_utils: cohesity_hints short_description: The **CohesityHints** utils module provides standard methods for returning query data from Cohesity Platforms. -version_added: 1.1.6 +version_added: 1.1.7 description: - The **CohesityHints** utils module provides standard methods for returning query data from Cohesity Platforms. @@ -640,7 +640,7 @@ def unregister_source(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( @@ -714,7 +714,7 @@ def check__protection_group__exists(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + self["token"], - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -773,7 +773,7 @@ def get_resource_pool_id(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, diff --git a/plugins/module_utils/cohesity_utilities.py b/plugins/module_utils/cohesity_utilities.py index 2d8f5eb..17fca2c 100644 --- a/plugins/module_utils/cohesity_utilities.py +++ b/plugins/module_utils/cohesity_utilities.py @@ -13,7 +13,7 @@ module_utils: cohesity_utilities short_description: The **CohesityUtilities** utils module provides the authentication token manage for Cohesity Platforms. -version_added: 1.1.6 +version_added: 1.1.7 description: - The **CohesityUtilities** utils module provides the authentication token manage for Cohesity Platforms. diff --git a/plugins/modules/cohesity_agent.py b/plugins/modules/cohesity_agent.py index 80ac91f..6b87169 100644 --- a/plugins/modules/cohesity_agent.py +++ b/plugins/modules/cohesity_agent.py @@ -305,7 +305,7 @@ def download_agent(module, path): headers = { "Accept": "application/octet-stream", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } elif not module.params.get("download_uri"): os_type = "Linux" @@ -334,13 +334,13 @@ def download_agent(module, path): headers = { "Accept": "application/octet-stream", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } else: uri = module.params.get("download_uri") headers = { "Accept": "application/octet-stream", - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } agent = open_url( @@ -612,7 +612,7 @@ def get_source_details(module, source_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -664,7 +664,7 @@ def update_agent(module): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = {"agentIds": [source_details["agent"]["id"]]} open_url( diff --git a/plugins/modules/cohesity_cancel_migration.py b/plugins/modules/cohesity_cancel_migration.py index 7ef545d..be270f5 100644 --- a/plugins/modules/cohesity_cancel_migration.py +++ b/plugins/modules/cohesity_cancel_migration.py @@ -64,7 +64,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: Cancel the VM migration -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -129,7 +129,7 @@ def check__protection_restore__exists(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -176,7 +176,7 @@ def cancel_migration(module, task_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, diff --git a/plugins/modules/cohesity_clone_vm.py b/plugins/modules/cohesity_clone_vm.py index deffe08..720b39d 100644 --- a/plugins/modules/cohesity_clone_vm.py +++ b/plugins/modules/cohesity_clone_vm.py @@ -127,7 +127,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Management of Cohesity VM Clone" -version_added: 1.1.6 +version_added: 1.1.7 """ @@ -506,7 +506,7 @@ def main(): global cohesity_client base_controller = BaseController() - base_controller.global_headers["user-agent"] = "cohesity-ansible/v1.1.6" + base_controller.global_headers["user-agent"] = "cohesity-ansible/v1.1.7" cohesity_client = get_cohesity_client(module) clone_exists, clone_details = get_clone_task(module, False) diff --git a/plugins/modules/cohesity_facts.py b/plugins/modules/cohesity_facts.py index 4b6d20f..646f3da 100644 --- a/plugins/modules/cohesity_facts.py +++ b/plugins/modules/cohesity_facts.py @@ -15,7 +15,7 @@ short_description: Gather facts about a Cohesity Cluster. description: - Gather facts about Cohesity Clusters. -version_added: 1.1.6 +version_added: 1.1.7 author: "Naveena (@naveena-maplelabs)" options: cluster: diff --git a/plugins/modules/cohesity_finalize_migration.py b/plugins/modules/cohesity_finalize_migration.py index 809229f..c5a9fd1 100644 --- a/plugins/modules/cohesity_finalize_migration.py +++ b/plugins/modules/cohesity_finalize_migration.py @@ -65,7 +65,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: Finalize the VM migration -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -154,7 +154,7 @@ def finalize_migration(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } body = { "restoreTaskId": self["task_id"], diff --git a/plugins/modules/cohesity_job.py b/plugins/modules/cohesity_job.py index 6460c24..ab5124e 100644 --- a/plugins/modules/cohesity_job.py +++ b/plugins/modules/cohesity_job.py @@ -227,7 +227,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Management of Cohesity Protection Jobs" -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -586,7 +586,7 @@ def get_vmware_ids(module, job_meta_data, job_details, vm_names): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -624,7 +624,7 @@ def get_vmware_vm_ids(module, job_meta_data, job_details, vm_names): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -669,7 +669,7 @@ def get_view_storage_domain_id(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -734,7 +734,7 @@ def register_job(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = self.copy() @@ -839,7 +839,7 @@ def start_job(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } source_ids = payload.get("sourceIds", []) payload = dict() @@ -898,7 +898,7 @@ def update_job(module, job_details, update_source_ids=None): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = job_details.copy() del payload["token"] @@ -960,7 +960,7 @@ def get_prot_job_details(self, module): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -1021,7 +1021,7 @@ def stop_job(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = self.copy() @@ -1085,7 +1085,7 @@ def unregister_job(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = dict(deleteSnapshots=self["deleteSnapshots"]) diff --git a/plugins/modules/cohesity_migrate_vm.py b/plugins/modules/cohesity_migrate_vm.py index 9bae04e..0ce5c64 100644 --- a/plugins/modules/cohesity_migrate_vm.py +++ b/plugins/modules/cohesity_migrate_vm.py @@ -166,6 +166,8 @@ description: - Specifies a folder name where the VMs should be restored. type: str + + job_vm_pair: description: - Key value pair with job names as key and list of Virtual Machines to @@ -175,7 +177,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: Migrate one or more Virtual Machines from Cohesity Migrate Jobs -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -288,7 +290,7 @@ def get_source_details(module): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -338,7 +340,7 @@ def get_vm_folder_id(module, source_id, resource_pool_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -388,7 +390,7 @@ def get_resource_pool_id(module, source_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -449,7 +451,7 @@ def get_datastore_id(module, source_id, resource_pool_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -498,7 +500,7 @@ def get_network_id(module, source_id, resource_pool_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -545,7 +547,7 @@ def get_backup_job_run_id(module, job_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -585,7 +587,7 @@ def get_backup_job_ids(module, job_names): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -629,7 +631,7 @@ def get_vmware_source_objects(module, source_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( @@ -691,7 +693,7 @@ def start_restore(module, uri, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = self.copy() @@ -733,7 +735,7 @@ def create_migration_task(module, body): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } # module.fail_json(msg=body) response = open_url( @@ -823,7 +825,7 @@ def get_protection_groups(module): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, diff --git a/plugins/modules/cohesity_migration_status.py b/plugins/modules/cohesity_migration_status.py index 8b63357..28c71b2 100644 --- a/plugins/modules/cohesity_migration_status.py +++ b/plugins/modules/cohesity_migration_status.py @@ -61,7 +61,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: Check Sync status of objects available in the VM migration task -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -148,7 +148,7 @@ def get_migration_status(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -180,7 +180,7 @@ def get_task_status(module, task_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, diff --git a/plugins/modules/cohesity_oracle_job.py b/plugins/modules/cohesity_oracle_job.py index 4eecaa1..2e366cb 100644 --- a/plugins/modules/cohesity_oracle_job.py +++ b/plugins/modules/cohesity_oracle_job.py @@ -131,7 +131,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Management of Cohesity Protection Jobs" -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ diff --git a/plugins/modules/cohesity_oracle_restore.py b/plugins/modules/cohesity_oracle_restore.py index bc08f39..eb8113c 100644 --- a/plugins/modules/cohesity_oracle_restore.py +++ b/plugins/modules/cohesity_oracle_restore.py @@ -135,7 +135,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Restore one or more Virtual Machines from Cohesity Protection Jobs" -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ diff --git a/plugins/modules/cohesity_oracle_source.py b/plugins/modules/cohesity_oracle_source.py index fd78cef..ac4ad9a 100644 --- a/plugins/modules/cohesity_oracle_source.py +++ b/plugins/modules/cohesity_oracle_source.py @@ -82,7 +82,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Management of Cohesity Protection Sources" -version_added: 1.1.6 +version_added: 1.1.7 """ diff --git a/plugins/modules/cohesity_plugin.py b/plugins/modules/cohesity_plugin.py index 96e3967..6eec33e 100644 --- a/plugins/modules/cohesity_plugin.py +++ b/plugins/modules/cohesity_plugin.py @@ -92,7 +92,7 @@ - "Determines whether to upgrade the connector plugin if already installed." type: bool short_description: "Management of Cohesity Datastore Plugin" -version_added: "1.1.6" +version_added: "1.1.7" """ EXAMPLES = """ @@ -205,7 +205,7 @@ def download_datastore_plugin(module): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-plugin": "cohesity-ansible/v1.1.6", + "user-plugin": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -252,7 +252,7 @@ def update_global_allow_lists(module): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-plugin": "cohesity-ansible/v1.1.6", + "user-plugin": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, diff --git a/plugins/modules/cohesity_policy.py b/plugins/modules/cohesity_policy.py index 88aaf0e..dd01d42 100644 --- a/plugins/modules/cohesity_policy.py +++ b/plugins/modules/cohesity_policy.py @@ -103,7 +103,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Cohesity Protection Policy" -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -506,7 +506,7 @@ def main(): global cohesity_client base_controller = BaseController() - base_controller.global_headers["user-agent"] = "cohesity-ansible/v1.1.6" + base_controller.global_headers["user-agent"] = "cohesity-ansible/v1.1.7" cohesity_client = get_cohesity_client(module) policy_exists, policy_details = get_policy_details(module) diff --git a/plugins/modules/cohesity_restore_file.py b/plugins/modules/cohesity_restore_file.py index 8914cd8..c46d5a1 100644 --- a/plugins/modules/cohesity_restore_file.py +++ b/plugins/modules/cohesity_restore_file.py @@ -15,7 +15,7 @@ - Ansible Module used to start a Cohesity Recovery Job on a Cohesity Cluster. - When executed in a playbook, the Cohesity Recovery Job will be validated and the appropriate state action - will be applied. -version_added: 1.1.6 +version_added: 1.1.7 author: "Naveena (@naveena-maplelabs)" options: cluster: @@ -379,7 +379,7 @@ def start_restore(module, uri, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = self.copy() @@ -428,7 +428,7 @@ def wait_restore_complete(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } attempts = 0 # => Wait for the restore based on a predetermined number of minutes with checks every 30 seconds. diff --git a/plugins/modules/cohesity_restore_vm.py b/plugins/modules/cohesity_restore_vm.py index 900ecdf..82f8033 100644 --- a/plugins/modules/cohesity_restore_vm.py +++ b/plugins/modules/cohesity_restore_vm.py @@ -190,7 +190,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Restore one or more Virtual Machines from Cohesity Protection Jobs" -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -305,7 +305,7 @@ def get_source_details(module, restore_to_source): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, @@ -354,7 +354,7 @@ def get_vmware_source_objects(module, source_id): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( @@ -432,7 +432,7 @@ def get__vmware_snapshot_information__by_source(module, self, source_details): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } objects = open_url( url=uri, @@ -580,7 +580,7 @@ def start_restore(module, uri, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = self.copy() @@ -629,7 +629,7 @@ def wait_restore_complete(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } attempts = 0 # => Wait for the restore based on a predetermined number of minutes with checks every 30 seconds. diff --git a/plugins/modules/cohesity_restore_vmware_file.py b/plugins/modules/cohesity_restore_vmware_file.py index 46651f8..345b4f5 100644 --- a/plugins/modules/cohesity_restore_vmware_file.py +++ b/plugins/modules/cohesity_restore_vmware_file.py @@ -14,7 +14,7 @@ - Ansible Module used to start a Cohesity Recovery Job on a Cohesity Cluster. - When executed in a playbook, the Cohesity Recovery Job will be validated and the appropriate state action - will be applied. -version_added: 1.1.6 +version_added: 1.1.7 author: "Naveena (@naveena-maplelabs)" options: @@ -265,7 +265,7 @@ def start_restore(module, uri, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = self.copy() @@ -353,7 +353,7 @@ def wait_restore_complete(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } attempts = 0 # => Wait for the restore based on a predetermined number of minutes with checks every 30 seconds. @@ -452,7 +452,7 @@ def main(): global cohesity_client base_controller = BaseController() - base_controller.global_headers["user-agent"] = "Ansible-v1.1.6" + base_controller.global_headers["user-agent"] = "Ansible-v1.1.7" cohesity_client = get_cohesity_client(module) if module.params.get("backup_id"): diff --git a/plugins/modules/cohesity_source.py b/plugins/modules/cohesity_source.py index 4754c21..ea24654 100644 --- a/plugins/modules/cohesity_source.py +++ b/plugins/modules/cohesity_source.py @@ -187,7 +187,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Management of Cohesity Protection Sources" -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -375,7 +375,7 @@ def refresh_source(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } uri = ( "https://" @@ -420,7 +420,7 @@ def register_sql_source(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } sql_payload = dict( applications=["kSQL"], @@ -468,7 +468,7 @@ def register_source(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = self.copy() payload["environment"] = "k" + self["environment"] diff --git a/plugins/modules/cohesity_storage_domain.py b/plugins/modules/cohesity_storage_domain.py deleted file mode 100644 index da443a7..0000000 --- a/plugins/modules/cohesity_storage_domain.py +++ /dev/null @@ -1,282 +0,0 @@ -import json -from ansible.module_utils.basic import AnsibleModule -from cohesity_management_sdk.controllers.base_controller import BaseController -from cohesity_management_sdk.exceptions.api_exception import APIException -from cohesity_management_sdk.models.quota_policy import QuotaPolicy -from cohesity_management_sdk.models.storage_policy import StoragePolicy -from cohesity_management_sdk.models.erasure_coding_info import ErasureCodingInfo - - - -try: - from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_utilities import ( - cohesity_common_argument_spec, - raise__cohesity_exception__handler, - ) - from ansible_collections.cohesity.dataprotect.plugins.module_utils.cohesity_hints import ( - get_cohesity_client, - ) - -except Exception: - pass -cohesity_client = None -TWENTY_GiB = 20 * (1024**3) -EIGHTEEN_GiB = 18 * (1024**3) -def get_domain_details(module): - """ - function to get the storage domain details - :param module: object that holds parameters passed to the module - :return: - """ - try: - domain_name = module.params.get("name") - storage_domains = ( - cohesity_client.storage_domain.get_storage_domains( - names=domain_name - ) - ) - if storage_domains: - for domain in storage_domains: - if domain.name == domain_name: - return True,domain - return False,None - except APIException as ex: - raise__cohesity_exception__handler( - str(json.loads(ex.context.response.raw_body)), module - ) - except Exception as error: - raise__cohesity_exception__handler(error, module) - -def set_quota(storage_domain_details, module): - """ - function to set the logical quota and alert threshold - :param view_request: request body - :param module: object that holds parameters passed to the module - :return: - """ - try: - quota_policy = QuotaPolicy() - if module.params.get("default_view_quota").get("set_logical_quota", False): - quota_policy.hard_limit_bytes = module.params.get("default_view_quota").get( - "hard_limit_bytes", TWENTY_GiB - ) - storage_domain_details.default_view_quota = quota_policy - if module.params.get("default_view_quota").get("set_alert_threshold", False): - quota_policy.alert_limit_bytes = module.params.get("default_view_quota").get( - "alert_limit_bytes", EIGHTEEN_GiB - ) - storage_domain_details.default_view_quota = quota_policy - if module.params.get("physical_quota").get("set_physical_quota", False): - quota_policy.hard_limit_bytes = module.params.get("physical_quota").get( - "hard_limit_bytes", TWENTY_GiB - ) - storage_domain_details.physical_quota = quota_policy - if module.params.get("physical_quota").get("set_alert_threshold", False): - quota_policy.alert_limit_bytes = module.params.get("physical_quota").get( - "alert_limit_bytes", EIGHTEEN_GiB - ) - storage_domain_details.physical_quota = quota_policy - return storage_domain_details - except Exception as error: - raise__cohesity_exception__handler(error, module) - - -def set_storage_policy(module): - try: - storage_policy = StoragePolicy() - if module.params.get("storage_policy").get("duplicate",False): - storage_policy.deduplication_enabled = module.params.get("storage_policy").get("duplicate",True) - if module.params.get("storage_policy").get("compression",False): - storage_policy.compression_policy=module.params.get("storage_policy").get("duplicate",True) - if module.params.get("storage_policy").get("erasure_coding_info",False): - storage_policy.erasure_coding_info=erasure_coding_params(module) - return storage_policy - except Exception as error: - raise__cohesity_exception__handler(error,module) - - -def erasure_coding_params(module): - try: - erasure = ErasureCodingInfo() - if module.params.get("storage_policy").get("erasure_coding",False): - erasure.erasure_coding_enabled = module.params.get("storage_policy").get("erasure_coding",False).get("enabled",False) - erasure.inline_erasure_coding = module.params.get("storage_policy").get("erasure_coding",False).get("inline_erasure",False) - erasure.num_coded_stripes = module.params.get("storage_policy").get("erasure_coding",False).get("inline_erasure",0) - erasure.num_data_stripes = module.params.get("storage_policy").get("erasure_coding",False).get("data_stripe",0) - return erasure - - except Exception as error: - raise__cohesity_exception__handler(error,module) - -def create_domain(module): - """ - function to create a storage domain - :param module: object that holds parameters passed to the module - :return: - """ - try: - storage_domain_details = dict( - name=module.params.get("name"), - description=module.params.get("description"), - state=module.params.get("state"), - stats=module.params.get("stats"), - encryption=module.params.get("encryption"), - ad_domain_name=module.params.get("ad_domain_name"), - cluster_partition_id=module.params.get("cluster_partion_id"), - cluster_partition_name=module.params.get("cluster_partition_name"), - id=module.params.get("id"), - kms_server_id=module.params.get("kms_server_id"), - ldap_provider_id=module.params.get("ldap_provider_id"), - ) - if module.params.get("default_view_quota"): - storage_domain_details = set_quota(storage_domain_details, module) - if module.params.get("physical_quota"): - storage_domain_details = set_quota(storage_domain_details, module) - if module.params.get("storage_policy"): - storage_domain_details.storage_policy=set_storage_policy(module) - domain_response = cohesity_client.storage_domain.create_storage_domain( - storage_domain_details - ) - - result = dict( - changed=True, - msg="Cohesity storage domain is created successfully", - id=domain_response.id, - task_name=module.params.get("name"), - ) - module.exit_json(**result) - - except APIException as ex: - raise__cohesity_exception__handler( - str(json.loads(ex.context.response.raw_body)), module - ) - except Exception as error: - raise__cohesity_exception__handler(error, module) - -def delete_domain(module, domain_id): - """ - function to delete the domain - :param module: object that holds parameters passed to the module - :param policy_id: domain id - :return: - """ - try: - cohesity_client.storage_domain.delete_storage_domain(id=domain_id) - except APIException as ex: - raise__cohesity_exception__handler( - str(json.loads(ex.context.response.raw_body)), module - ) - except Exception as error: - raise__cohesity_exception__handler(error, module) - -def main(): - # => Load the default arguments including those specific to the Cohesity storage domain. - argument_spec = cohesity_common_argument_spec() - argument_spec.update( - dict( - name=dict(type="str", required=True), - description=dict(type="str", default=""), - state=dict(choices=["present", "absent"], default="present"), - ad_domain_name=dict(type="str", default=""), - cluster_partition_id=dict(type="int", default=3), - cluster_partition_name=dict(type="str", default="DefaultPartition"), - default_view_quota=dict(type="dict", required=False), - id=dict(type="int",default=None), - stats=dict(type="dict",required=False), - kms_server_id=dict(type="int",default=None), - ldap_provider_id=dict(type="int",default=None), - storage_policy=dict(type="dict", required=False), - duplicate=dict(default=True, type="bool"), - compression=dict(default=True,type="bool"), - encryption=dict(default=False,type="bool"), - logical_quota=dict(type="dict", required=False), - physical_quota=dict(type="dict", required=False), - inline_deduplication=dict(type="bool", default=True), - inline_compression=dict(type="bool", default=True), - erasure_coding_params=dict(type="dict",required=False), - ) - ) - - # => Create a new module object - module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - results = dict( - changed=False, - msg="Attempting to manage Cohesity storage domain", - state=module.params.get("state"), - ) - - global cohesity_client - base_controller = BaseController() - base_controller.global_headers["user-agent"] = "cohesity-ansible/v1.1.2" - cohesity_client = get_cohesity_client(module) - domain_exists,domain_details = get_domain_details(module) - - """ To be done later - if module.check_mode: - check_mode_results = dict( - changed=False, - msg="Check Mode: Cohesity storage domain doesn't exist", - id="", - ) - if module.params.get("state") == "present": - if domain_exists: - check_mode_results[ - "msg" - ] = "Check Mode: Cohesity storage domain is already present. No changes" - check_mode_results["id"] = domain_details.id - else: - check_mode_results["msg"] = ( - "Check Mode: Cohesity storage domain doesn't exist." - " This action would create a storage domain " - ) - check_mode_results["id"] = domain_exists - else: - if domain_exists: - check_mode_results[ - "msg" - ] = "Check Mode: Cohesity Protection Job is currently registered. This action would unregister the Cohesity Protection Job." - check_mode_results["id"] = domain_exists - else: - check_mode_results[ - "msg" - ] = "Check Mode: Cohesity Protection Job is not currently registered. No changes." - module.exit_json(**check_mode_results) - """ - if module.params.get("state") == "present": - - if domain_exists: - results = dict( - changed=False, - msg="The Cohesity storage domain with specified name is already present", - id=domain_details.id, - domain_name=module.params.get("name"), - ) - else: - create_domain(module) - - elif module.params.get("state") == "absent": - if domain_exists: - delete_domain(module, domain_details.id) - results = dict( - changed=True, - msg="Cohesity storage domain is deleted", - id=domain_details.id, - domain_name=module.params.get("name"), - ) - else: - results = dict( - changed=False, - msg="Cohesity storage domain doesn't exist", - domain_name=module.params.get("name"), - ) - else: - module.fail_json( - msg="Invalid State selected: {0}".format(module.params.get("state")), - changed=False, - ) - - module.exit_json(**results) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/cohesity_sync_objects.py b/plugins/modules/cohesity_sync_objects.py index 1111109..9c3a020 100644 --- a/plugins/modules/cohesity_sync_objects.py +++ b/plugins/modules/cohesity_sync_objects.py @@ -66,7 +66,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: Sync objects available in the VM migration task -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -154,7 +154,7 @@ def sync_objects(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } body = { "restoreTaskId": self["task_id"], diff --git a/plugins/modules/cohesity_uda_protection_group.py b/plugins/modules/cohesity_uda_protection_group.py index ff19562..4a0f23c 100644 --- a/plugins/modules/cohesity_uda_protection_group.py +++ b/plugins/modules/cohesity_uda_protection_group.py @@ -199,7 +199,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: Management of Cohesity UDA Protection Groups -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -455,7 +455,7 @@ def create_group(module, self, body): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } response = open_url( url=uri, diff --git a/plugins/modules/cohesity_uda_source.py b/plugins/modules/cohesity_uda_source.py index 439afba..46e5808 100644 --- a/plugins/modules/cohesity_uda_source.py +++ b/plugins/modules/cohesity_uda_source.py @@ -128,7 +128,7 @@ extends_documentation_fragment: - cohesity.dataprotect.cohesity short_description: "Management of UDA Protection Sources" -version_added: 1.1.6 +version_added: 1.1.7 """ EXAMPLES = """ @@ -218,7 +218,7 @@ def register_source(module, self): headers = { "Accept": "application/json", "Authorization": "Bearer " + token, - "user-agent": "cohesity-ansible/v1.1.6", + "user-agent": "cohesity-ansible/v1.1.7", } payload = dict( environment="kUDA", diff --git a/plugins/modules/cohesity_view.py b/plugins/modules/cohesity_view.py index ee39a1c..26527f4 100644 --- a/plugins/modules/cohesity_view.py +++ b/plugins/modules/cohesity_view.py @@ -14,7 +14,7 @@ short_description: Management of Cohesity View description: - Ansible Module to create View. -version_added: 1.1.6 +version_added: 1.1.7 author: "Naveena (@naveena-maplelabs)" options: case_insensitive: @@ -460,7 +460,7 @@ def main(): global cohesity_client base_controller = BaseController() - base_controller.global_headers["user-agent"] = "cohesity-ansible/v1.1.6" + base_controller.global_headers["user-agent"] = "cohesity-ansible/v1.1.7" cohesity_client = get_cohesity_client(module) view_exists, view_details = get_view_details(module) diff --git a/plugins/modules/cohesity_win_agent.py b/plugins/modules/cohesity_win_agent.py index 294ed32..6540684 100644 --- a/plugins/modules/cohesity_win_agent.py +++ b/plugins/modules/cohesity_win_agent.py @@ -17,7 +17,7 @@ - When executed in a playbook, the Cohesity Agent installation will be validated and the appropriate - state action will be applied. The most recent version of the Cohesity Agent will be automatically - downloaded to the host. -version_added: 1.1.6 +version_added: 1.1.7 author: "Naveena (@naveena-maplelabs)" options: cluster: