Skip to content

Commit

Permalink
Add new module to manage backup policies (#373)
Browse files Browse the repository at this point in the history
* init from role assignment

* init backup policy module

* test

* test

* test

* bad bool casing

* test

* update set_results

* init policy create

* adding model to common

* updated needs hardcoded values removed

* Added daily and weekly support for VM backups

* added another error check on params

* spacing

* Added integration tests

* Added idempotence test

* fix sanity test issues

* Add new dependencies to requirements-azure.txt

* Apply suggestions from code review

Update references to "required" params

Co-authored-by: Fred-sun <[email protected]>

* Update params to be more inline with other modules

* Apply suggestions from code review

Documentation suggestions

Co-authored-by: Fred-sun <[email protected]>

* Update with info module

* Changes from sanity test

* update test block

* update test block

* Change var name

* Fix noncompliant module

* Update test facts setup

Co-authored-by: Fred-sun <[email protected]>
  • Loading branch information
coleneubauer and Fred-sun authored Mar 4, 2021
1 parent aca5b5d commit 9dc678c
Show file tree
Hide file tree
Showing 8 changed files with 851 additions and 2 deletions.
16 changes: 16 additions & 0 deletions plugins/module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ def default_api_version(self):
from msrestazure import AzureConfiguration
from msrest.authentication import Authentication
from azure.mgmt.resource.locks import ManagementLockClient
from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient
import azure.mgmt.recoveryservicesbackup.models as RecoveryServicesBackupModels

except ImportError as exc:
Authentication = object
HAS_AZURE_EXC = traceback.format_exc()
Expand Down Expand Up @@ -424,6 +427,7 @@ def __init__(self, derived_arg_spec, bypass_checks=False, no_log=False,
self._automation_client = None
self._IoThub_client = None
self._lock_client = None
self._recovery_services_backup_client = None

self.check_mode = self.module.check_mode
self.api_profile = self.module.params.get('api_profile')
Expand Down Expand Up @@ -1252,6 +1256,18 @@ def lock_models(self):
self.log("Getting lock models")
return ManagementLockClient.models('2016-09-01')

@property
def recovery_services_backup_client(self):
self.log('Getting recovery services backup client')
if not self._recovery_services_backup_client:
self._recovery_services_backup_client = self.get_mgmt_svc_client(RecoveryServicesBackupClient,
base_url=self._cloud_environment.endpoints.resource_manager)
return self._recovery_services_backup_client

@property
def recovery_services_backup_models(self):
return RecoveryServicesBackupModels


class AzureSASAuthentication(Authentication):
"""Simple SAS Authentication.
Expand Down
Loading

0 comments on commit 9dc678c

Please sign in to comment.