| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
from __future__ import absolute_import, division, print_function |
| 8 |
__metaclass__ = type |
| 9 |
|
| 10 |
|
| 11 |
ANSIBLE_METADATA = {'metadata_version': '1.1', |
| 12 |
'status': ['preview'], |
| 13 |
'supported_by': 'community'} |
| 14 |
|
| 15 |
|
| 16 |
DOCUMENTATION = ''' |
| 17 |
--- |
| 18 |
module: azure_rm_backuppolicy |
| 19 |
version_added: "1.4.0" |
| 20 |
short_description: Manage Azure Backup Policy |
| 21 |
description: |
| 22 |
- Create and delete instance of Azure Backup Policy. |
| 23 |
|
| 24 |
options: |
| 25 |
vault_name: |
| 26 |
description: |
| 27 |
- The name of the Recovery Services Vault the policy belongs to. |
| 28 |
required: true |
| 29 |
type: str |
| 30 |
name: |
| 31 |
description: |
| 32 |
- The name of the backup policy. |
| 33 |
required: true |
| 34 |
type: str |
| 35 |
resource_group: |
| 36 |
description: |
| 37 |
- The name of the resource group the vault is in. |
| 38 |
required: true |
| 39 |
type: str |
| 40 |
state: |
| 41 |
description: |
| 42 |
- Assert the state of the backup policy. |
| 43 |
- Use C(present) to create or update a backup policy and C(absent) to delete it. |
| 44 |
default: present |
| 45 |
choices: |
| 46 |
- absent |
| 47 |
- present |
| 48 |
type: str |
| 49 |
backup_management_type: |
| 50 |
description: |
| 51 |
- Defines the type of resource the policy will be applied to. |
| 52 |
choices: |
| 53 |
- AzureIaasVM |
| 54 |
type: str |
| 55 |
policy_type: |
| 56 |
description: |
| 57 |
- Defines the type of backup policy |
| 58 |
default: V1 |
| 59 |
choices: |
| 60 |
- V1 |
| 61 |
- V2 |
| 62 |
type: str |
| 63 |
schedule_run_time: |
| 64 |
description: |
| 65 |
- The hour to run backups. |
| 66 |
- Valid choices are on 24 hour scale (0-23). |
| 67 |
type: int |
| 68 |
instant_recovery_snapshot_retention: |
| 69 |
description: |
| 70 |
- How many days to retain instant recovery snapshots. |
| 71 |
type: int |
| 72 |
schedule_run_frequency: |
| 73 |
description: |
| 74 |
- The frequency to run the policy. |
| 75 |
choices: |
| 76 |
- Daily |
| 77 |
- Weekly |
| 78 |
type: str |
| 79 |
schedule_days: |
| 80 |
description: |
| 81 |
- List of days to execute the schedule. |
| 82 |
- Does not apply to Daily frequency. |
| 83 |
type: list |
| 84 |
elements: str |
| 85 |
weekly_retention_count: |
| 86 |
description: |
| 87 |
- The amount of weeks to retain backups. |
| 88 |
type: int |
| 89 |
daily_retention_count: |
| 90 |
description: |
| 91 |
- The amount of days to retain backups. |
| 92 |
- Does not apply to Weekly frequency. |
| 93 |
type: int |
| 94 |
schedule_weekly_frequency: |
| 95 |
description: |
| 96 |
- The amount of weeks between backups. |
| 97 |
- Backup every I(schedule_weekly_frequency) week(s). |
| 98 |
- Azure will default behavior to running weekly if this is left blank. |
| 99 |
- Does not apply to Daily frequency. |
| 100 |
type: int |
| 101 |
time_zone: |
| 102 |
description: |
| 103 |
- Timezone to apply I(schedule_run_time). |
| 104 |
default: UTC |
| 105 |
type: str |
| 106 |
extends_documentation_fragment: |
| 107 |
- azure.azcollection.azure |
| 108 |
|
| 109 |
author: |
| 110 |
- Cole Neubauer(@coleneubauer) |
| 111 |
''' |
| 112 |
|
| 113 |
EXAMPLES = ''' |
| 114 |
- name: Delete a backup policy |
| 115 |
azure_rm_backuppolicy: |
| 116 |
vault_name: Vault_Name |
| 117 |
name: Policy_Name |
| 118 |
resource_group: Resource_Group_Name |
| 119 |
state: absent |
| 120 |
|
| 121 |
- name: Create a daily VM backup policy |
| 122 |
azure_rm_backuppolicy: |
| 123 |
vault_name: Vault_Name |
| 124 |
name: Policy_Name |
| 125 |
resource_group: Resource_Group_Name |
| 126 |
state: present |
| 127 |
backup_management_type: "AzureIaasVM" |
| 128 |
schedule_run_frequency: "Daily" |
| 129 |
instant_recovery_snapshot_retention: 2 |
| 130 |
daily_retention_count: 12 |
| 131 |
time_zone: "Pacific Standard Time" |
| 132 |
schedule_run_time: 14 |
| 133 |
|
| 134 |
- name: Create a weekly VM backup policy |
| 135 |
azure.azcollection.azure_rm_backuppolicy: |
| 136 |
vault_name: Vault_Name |
| 137 |
name: Policy_Name |
| 138 |
resource_group: Resource_Group_Name |
| 139 |
state: present |
| 140 |
backup_management_type: "AzureIaasVM" |
| 141 |
schedule_run_frequency: "Weekly" |
| 142 |
instant_recovery_snapshot_retention: 5 |
| 143 |
weekly_retention_count: 4 |
| 144 |
schedule_days: |
| 145 |
- "Monday" |
| 146 |
- "Wednesday" |
| 147 |
- "Friday" |
| 148 |
time_zone: "Pacific Standard Time" |
| 149 |
schedule_run_time: 8 |
| 150 |
|
| 151 |
- name: Create daily enhanced policy |
| 152 |
azure.azcollection.azure_rm_backuppolicy: |
| 153 |
vault_name: Vault_Name |
| 154 |
name: Policy_Name_Enhanced |
| 155 |
resource_group: Resource_Group_Name |
| 156 |
policy_type: V2 |
| 157 |
state: present |
| 158 |
backup_management_type: AzureIaasVM |
| 159 |
schedule_run_frequency: Daily |
| 160 |
instant_recovery_snapshot_retention: 7 |
| 161 |
daily_retention_count: 28 |
| 162 |
time_zone: UTC |
| 163 |
schedule_run_time: 20 |
| 164 |
''' |
| 165 |
|
| 166 |
RETURN = ''' |
| 167 |
id: |
| 168 |
description: |
| 169 |
- Id of specified backup policy. |
| 170 |
returned: always |
| 171 |
type: str |
| 172 |
sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.RecoveryServices/vaults/Vault_Name/backupPolicies/Policy_Name" |
| 173 |
location: |
| 174 |
description: |
| 175 |
- Location of backup policy. |
| 176 |
type: str |
| 177 |
returned: always |
| 178 |
sample: eastus |
| 179 |
name: |
| 180 |
description: |
| 181 |
- Name of backup policy. |
| 182 |
type: str |
| 183 |
returned: always |
| 184 |
sample: DefaultPolicy |
| 185 |
type: |
| 186 |
description: |
| 187 |
- Type of backup policy. |
| 188 |
type: str |
| 189 |
returned: always |
| 190 |
sample: Microsoft.RecoveryServices/vaults/backupPolicies |
| 191 |
properties: |
| 192 |
description: |
| 193 |
- Attributes of the backup policy. |
| 194 |
type: dict |
| 195 |
returned: always |
| 196 |
sample: { |
| 197 |
"backup_management_type": "AzureIaasVM", |
| 198 |
"instant_rp_details": {}, |
| 199 |
"instant_rp_retention_range_in_days": 5, |
| 200 |
"protected_items_count": 0, |
| 201 |
"retention_policy": { |
| 202 |
"retention_policy_type": "LongTermRetentionPolicy", |
| 203 |
"weekly_schedule": { |
| 204 |
"days_of_the_week": [ |
| 205 |
"Monday", |
| 206 |
"Wednesday", |
| 207 |
"Thursday" |
| 208 |
], |
| 209 |
"retention_duration": { |
| 210 |
"count": 4, |
| 211 |
"duration_type": "Weeks" |
| 212 |
}, |
| 213 |
"retention_times": [ |
| 214 |
"2025-04-09T10:00:00.000Z" |
| 215 |
] |
| 216 |
} |
| 217 |
}, |
| 218 |
"schedule_policy": { |
| 219 |
"schedule_policy_type": "SimpleSchedulePolicy", |
| 220 |
"schedule_run_days": [ |
| 221 |
"Monday", |
| 222 |
"Wednesday", |
| 223 |
"Thursday" |
| 224 |
], |
| 225 |
"schedule_run_frequency": "Weekly", |
| 226 |
"schedule_run_times": [ |
| 227 |
"2025-04-09T10:00:00.000Z" |
| 228 |
], |
| 229 |
"schedule_weekly_frequency": 0 |
| 230 |
}, |
| 231 |
"time_zone": "Pacific Standard Time" |
| 232 |
} |
| 233 |
''' |
| 234 |
|
| 235 |
from datetime import datetime |
| 236 |
from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase |
| 237 |
|
| 238 |
try: |
| 239 |
from azure.core.exceptions import ResourceNotFoundError |
| 240 |
|
| 241 |
except ImportError: |
| 242 |
|
| 243 |
pass |
| 244 |
|
| 245 |
|
| 246 |
class AzureRMBackupPolicy(AzureRMModuleBase): |
| 247 |
"""Configuration class for an Azure RM Backup Policy""" |
| 248 |
|
| 249 |
def __init__(self): |
| 250 |
self.module_arg_spec = dict( |
| 251 |
vault_name=dict(type='str', required=True), |
| 252 |
name=dict(type='str', required=True), |
| 253 |
resource_group=dict(type='str', required=True), |
| 254 |
state=dict(type='str', default='present', choices=['present', 'absent']), |
| 255 |
backup_management_type=dict(type='str', choices=['AzureIaasVM']), |
| 256 |
policy_type=dict(type='str', default='V1', choices=['V1', 'V2']), |
| 257 |
schedule_run_time=dict(type='int'), |
| 258 |
instant_recovery_snapshot_retention=dict(type='int'), |
| 259 |
schedule_run_frequency=dict(type='str', choices=['Daily', 'Weekly']), |
| 260 |
schedule_days=dict(type='list', elements='str'), |
| 261 |
weekly_retention_count=dict(type='int'), |
| 262 |
daily_retention_count=dict(type='int'), |
| 263 |
schedule_weekly_frequency=dict(type='int'), |
| 264 |
time_zone=dict(type='str', default='UTC'), |
| 265 |
) |
| 266 |
|
| 267 |
self.vault_name = None |
| 268 |
self.name = None |
| 269 |
self.resource_group = None |
| 270 |
self.backup_management_type = None |
| 271 |
self.policy_type = None |
| 272 |
self.schedule_run_time = None |
| 273 |
self.instant_recovery_snapshot_retention = None |
| 274 |
self.schedule_run_frequency = None |
| 275 |
self.schedule_days = None |
| 276 |
self.weekly_retention_count = None |
| 277 |
self.schedule_weekly_frequency = None |
| 278 |
self.daily_retention_count = None |
| 279 |
self.time_zone = None |
| 280 |
|
| 281 |
self.results = dict( |
| 282 |
changed=False, |
| 283 |
id=None, |
| 284 |
) |
| 285 |
|
| 286 |
required_if = [('schedule_run_frequency', 'Weekly', ['schedule_days', 'weekly_retention_count', 'schedule_run_time']), |
| 287 |
('schedule_run_frequency', 'Daily', ['daily_retention_count', 'schedule_run_time']), |
| 288 |
('state', 'present', ['schedule_run_frequency', 'backup_management_type']), |
| 289 |
('log_mode', 'file', ['log_path'])] |
| 290 |
|
| 291 |
super(AzureRMBackupPolicy, self).__init__(derived_arg_spec=self.module_arg_spec, |
| 292 |
supports_check_mode=True, |
| 293 |
supports_tags=False, |
| 294 |
required_if=required_if) |
| 295 |
|
| 296 |
def exec_module(self, **kwargs): |
| 297 |
"""Main module execution method""" |
| 298 |
|
| 299 |
for key in self.module_arg_spec: |
| 300 |
setattr(self, key, kwargs[key]) |
| 301 |
|
| 302 |
existing_backup_policy = None |
| 303 |
response = None |
| 304 |
|
| 305 |
old_res = self.get_backup_policy() |
| 306 |
|
| 307 |
|
| 308 |
if self.state == 'present': |
| 309 |
|
| 310 |
if not old_res: |
| 311 |
self.log("Backup policy {0} for vault {1} in resource group {2} does not exist.".format(self.name, |
| 312 |
self.vault_name, |
| 313 |
self.resource_group)) |
| 314 |
|
| 315 |
self.results['changed'] = True |
| 316 |
|
| 317 |
if self.check_mode: |
| 318 |
return self.results |
| 319 |
|
| 320 |
response = self.create_or_update_backup_policy() |
| 321 |
self.results.update(self.set_results(response)) |
| 322 |
|
| 323 |
|
| 324 |
else: |
| 325 |
self.log("Backup policy {0} for vault {1} in resource group {2} already exists, updating".format(self.name, |
| 326 |
self.vault_name, |
| 327 |
self.resource_group)) |
| 328 |
if self.schedule_run_frequency is not None and\ |
| 329 |
self.schedule_run_frequency != old_res['properties']['schedule_policy']['schedule_run_frequency']: |
| 330 |
self.results['changed'] = True |
| 331 |
elif self.time_zone is not None and self.time_zone != old_res['properties']['time_zone']: |
| 332 |
self.results['changed'] = True |
| 333 |
elif self.instant_recovery_snapshot_retention is not None and\ |
| 334 |
self.instant_recovery_snapshot_retention != old_res['properties']['instant_rp_retention_range_in_days']: |
| 335 |
self.results['changed'] = True |
| 336 |
elif self.schedule_weekly_frequency is not None and\ |
| 337 |
self.schedule_weekly_frequency != old_res['properties']['schedule_policy']['schedule_weekly_frequency']: |
| 338 |
self.results['changed'] = True |
| 339 |
if self.weekly_retention_count is not None: |
| 340 |
if self.weekly_retention_count !=\ |
| 341 |
old_res['properties']['retention_policy'].get('weekly_schedule', {}).get('retention_duration', {}).get('count'): |
| 342 |
self.results['changed'] = True |
| 343 |
if self.daily_retention_count is not None: |
| 344 |
if self.daily_retention_count !=\ |
| 345 |
old_res['properties']['retention_policy'].get('daily_schedule', {}).get('retention_duration', {}).get('count'): |
| 346 |
self.results['changed'] = True |
| 347 |
if self.schedule_days is not None: |
| 348 |
if old_res['properties']['schedule_policy'].get('schedule_run_days') is not None: |
| 349 |
if set(self.schedule_days) != set(old_res['properties']['schedule_policy']['schedule_run_days']): |
| 350 |
self.results['changed'] = True |
| 351 |
else: |
| 352 |
self.results['changed'] = True |
| 353 |
|
| 354 |
if self.check_mode: |
| 355 |
self.results.update(old_res) |
| 356 |
return self.results |
| 357 |
else: |
| 358 |
if self.results['changed']: |
| 359 |
response = self.create_or_update_backup_policy() |
| 360 |
self.results.update(self.set_results(response)) |
| 361 |
else: |
| 362 |
self.results.update(old_res) |
| 363 |
|
| 364 |
elif self.state == 'absent': |
| 365 |
if old_res: |
| 366 |
self.log("Delete backup policy") |
| 367 |
self.results['changed'] = True |
| 368 |
|
| 369 |
if self.check_mode: |
| 370 |
self.results.update(old_res) |
| 371 |
return self.results |
| 372 |
|
| 373 |
self.delete_backup_policy() |
| 374 |
|
| 375 |
self.log('backup policy deleted') |
| 376 |
|
| 377 |
else: |
| 378 |
|
| 379 |
self.log("Backup policy {0} for vault {1} in resource group {2} does not exist.".format(self.name, |
| 380 |
self.vault_name, |
| 381 |
self.resource_group)) |
| 382 |
|
| 383 |
return self.results |
| 384 |
|
| 385 |
def create_or_update_backup_policy(self): |
| 386 |
''' |
| 387 |
Creates or updates backup policy. |
| 388 |
|
| 389 |
:return: ProtectionPolicyResource |
| 390 |
''' |
| 391 |
self.log("Creating backup policy {0} for vault {1} in resource group {2}".format(self.name, |
| 392 |
self.vault_name, |
| 393 |
self.resource_group)) |
| 394 |
self.log("Creating backup policy in progress") |
| 395 |
|
| 396 |
response = None |
| 397 |
|
| 398 |
try: |
| 399 |
instant_rp_details = None |
| 400 |
|
| 401 |
|
| 402 |
dt = datetime.utcnow() |
| 403 |
dt = datetime(dt.year, dt.month, dt.day, 0, 0) |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
schedule_run_times_as_datetimes = [] |
| 408 |
schedule_run_time = self.schedule_run_time |
| 409 |
|
| 410 |
|
| 411 |
try: |
| 412 |
if 0 <= schedule_run_time <= 23: |
| 413 |
schedule_run_times_as_datetimes = [(dt.replace(hour=schedule_run_time))] |
| 414 |
else: |
| 415 |
raise ValueError('Paramater schedule_run_time {0} is badly formed must be on the 24 hour scale'.format(schedule_run_time)) |
| 416 |
|
| 417 |
if self.schedule_run_frequency == "Weekly" and self.instant_recovery_snapshot_retention != 5: |
| 418 |
raise ValueError('Paramater instant_recovery_snapshot_retention was {0} but must be 5 when schedule_run_frequency is Weekly' |
| 419 |
.format(self.instant_recovery_snapshot_retention)) |
| 420 |
|
| 421 |
if self.schedule_run_frequency == "Weekly" and not (1 <= self.weekly_retention_count <= 5163): |
| 422 |
raise ValueError('Paramater weekly_retention_count was {0} but must be between 1 and 5163 when schedule_run_frequency is Weekly' |
| 423 |
.format(self.weekly_retention_count)) |
| 424 |
|
| 425 |
if self.schedule_run_frequency == "Daily" and not (7 <= self.daily_retention_count <= 9999): |
| 426 |
raise ValueError('Paramater daily_retention_count was {0} but must be between 7 and 9999 when schedule_run_frequency is Daily' |
| 427 |
.format(self.daily_retention_count)) |
| 428 |
|
| 429 |
except ValueError as e: |
| 430 |
self.results['changed'] = False |
| 431 |
self.fail(e) |
| 432 |
|
| 433 |
|
| 434 |
if self.policy_type == 'V1': |
| 435 |
schedule_policy = self.recovery_services_backup_models.SimpleSchedulePolicy(schedule_run_frequency=self.schedule_run_frequency, |
| 436 |
schedule_run_days=self.schedule_days, |
| 437 |
schedule_run_times=schedule_run_times_as_datetimes, |
| 438 |
schedule_weekly_frequency=self.schedule_weekly_frequency) |
| 439 |
elif self.policy_type == 'V2': |
| 440 |
schedule_policy = self.recovery_services_backup_models.SimpleSchedulePolicyV2( |
| 441 |
schedule_run_frequency=self.schedule_run_frequency, daily_schedule=self.recovery_services_backup_models.WeeklySchedule( |
| 442 |
schedule_run_days=self.schedule_days, schedule_run_times=schedule_run_times_as_datetimes)) |
| 443 |
|
| 444 |
daily_retention_schedule = None |
| 445 |
weekly_retention_schedule = None |
| 446 |
|
| 447 |
|
| 448 |
if (self.daily_retention_count and self.schedule_run_frequency == "Daily"): |
| 449 |
retention_duration = self.recovery_services_backup_models.RetentionDuration(count=self.daily_retention_count, duration_type="Days") |
| 450 |
daily_retention_schedule = self.recovery_services_backup_models.DailyRetentionSchedule(retention_times=schedule_run_times_as_datetimes, |
| 451 |
retention_duration=retention_duration) |
| 452 |
|
| 453 |
if (self.weekly_retention_count): |
| 454 |
retention_duration = self.recovery_services_backup_models.RetentionDuration(count=self.weekly_retention_count, |
| 455 |
duration_type="Weeks") |
| 456 |
weekly_retention_schedule = self.recovery_services_backup_models.WeeklyRetentionSchedule(days_of_the_week=self.schedule_days, |
| 457 |
retention_times=schedule_run_times_as_datetimes, |
| 458 |
retention_duration=retention_duration) |
| 459 |
|
| 460 |
retention_policy = self.recovery_services_backup_models.LongTermRetentionPolicy(daily_schedule=daily_retention_schedule, |
| 461 |
weekly_schedule=weekly_retention_schedule) |
| 462 |
|
| 463 |
policy_definition = None |
| 464 |
|
| 465 |
if self.backup_management_type == "AzureIaasVM": |
| 466 |
|
| 467 |
AzureIaaSVMProtectionPolicy = self.recovery_services_backup_models.AzureIaaSVMProtectionPolicy |
| 468 |
policy_definition = AzureIaaSVMProtectionPolicy(instant_rp_details=instant_rp_details, |
| 469 |
schedule_policy=schedule_policy, |
| 470 |
retention_policy=retention_policy, |
| 471 |
instant_rp_retention_range_in_days=self.instant_recovery_snapshot_retention, |
| 472 |
time_zone=self.time_zone, |
| 473 |
policy_type=self.policy_type) |
| 474 |
|
| 475 |
if policy_definition: |
| 476 |
policy_resource = self.recovery_services_backup_models.ProtectionPolicyResource(properties=policy_definition) |
| 477 |
response = self.recovery_services_backup_client.protection_policies.create_or_update(vault_name=self.vault_name, |
| 478 |
resource_group_name=self.resource_group, |
| 479 |
policy_name=self.name, |
| 480 |
parameters=policy_resource) |
| 481 |
|
| 482 |
except Exception as e: |
| 483 |
self.log('Error attempting to create the backup policy.') |
| 484 |
self.fail("Error creating the backup policy {0} for vault {1} in resource group {2}. Error Reads: {3}".format(self.name, |
| 485 |
self.vault_name, |
| 486 |
self.resource_group, e)) |
| 487 |
|
| 488 |
return response |
| 489 |
|
| 490 |
def delete_backup_policy(self): |
| 491 |
''' |
| 492 |
Deletes specified backup policy. |
| 493 |
|
| 494 |
:return: ProtectionPolicyResource |
| 495 |
''' |
| 496 |
self.log("Deleting the backup policy {0} for vault {1} in resource group {2}".format(self.name, self.vault_name, self.resource_group)) |
| 497 |
|
| 498 |
response = None |
| 499 |
|
| 500 |
try: |
| 501 |
response = self.recovery_services_backup_client.protection_policies.begin_delete(vault_name=self.vault_name, |
| 502 |
resource_group_name=self.resource_group, |
| 503 |
policy_name=self.name) |
| 504 |
|
| 505 |
except Exception as e: |
| 506 |
self.log('Error attempting to delete the backup policy.') |
| 507 |
self.fail("Error deleting the backup policy {0} for vault {1} in resource group {2}. Error Reads: {3}".format(self.name, |
| 508 |
self.vault_name, |
| 509 |
self.resource_group, e)) |
| 510 |
|
| 511 |
return response |
| 512 |
|
| 513 |
def get_backup_policy(self): |
| 514 |
''' |
| 515 |
Gets the properties of the specified backup policy. |
| 516 |
|
| 517 |
:return: ProtectionPolicyResource |
| 518 |
''' |
| 519 |
self.log("Checking if the backup policy {0} for vault {1} in resource group {2} is present".format(self.name, |
| 520 |
self.vault_name, |
| 521 |
self.resource_group)) |
| 522 |
|
| 523 |
policy = None |
| 524 |
|
| 525 |
try: |
| 526 |
policy = self.recovery_services_backup_client.protection_policies.get(vault_name=self.vault_name, |
| 527 |
resource_group_name=self.resource_group, |
| 528 |
policy_name=self.name) |
| 529 |
except ResourceNotFoundError as ex: |
| 530 |
self.log("Could not find backup policy {0} for vault {1} in resource group {2}".format(self.name, self.vault_name, self.resource_group)) |
| 531 |
|
| 532 |
return self.set_results(policy) |
| 533 |
|
| 534 |
def set_results(self, policy): |
| 535 |
result = dict() |
| 536 |
if policy: |
| 537 |
result['id'] = policy.id |
| 538 |
result['location'] = policy.location |
| 539 |
result['name'] = policy.name |
| 540 |
result['type'] = policy.type |
| 541 |
result['properties'] = policy.properties.as_dict() |
| 542 |
return result |
| 543 |
else: |
| 544 |
return None |
| 545 |
|
| 546 |
|
| 547 |
def main(): |
| 548 |
"""Main execution""" |
| 549 |
AzureRMBackupPolicy() |
| 550 |
|
| 551 |
|
| 552 |
if __name__ == '__main__': |
| 553 |
main() |