Skip to content

Commit

Permalink
[Backup] Added optional parameter backupManagementType in backup poli…
Browse files Browse the repository at this point in the history
…cy list-associated-items (Azure#11324)

* Added BackupManagementType as an optional parameter

* updated help message

* updated history.rst
  • Loading branch information
sambitratha authored and qwordy committed Nov 20, 2019
1 parent f4ee73b commit 72b2e89
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Release History
* Fix issue #11100: AttributeError for az webapp up when create service plan
* az webapp up: Forcing the creation or deployment to a site for supported languages, no defaults used.

**Backup**

* Fix issue in az backup policy list-associated-items. Added optional BackupManagementType parameter.

**Compute**

* Upgrade API version of compute, disks, snapshots to 2019-07-01
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/backup/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
short-summary: List all items protected by a backup policy.
examples:
- name: List all items protected by a backup policy
text: az backup policy list-associated-items --name MyBackupPolicy --resource-group MyResourceGroup --vault-name MyVault
text: az backup policy list-associated-items --name MyBackupPolicy --resource-group MyResourceGroup --vault-name MyVault --backup-management-type AzureIaasVM
crafted: true
"""

Expand Down
3 changes: 3 additions & 0 deletions src/azure-cli/azure/cli/command_modules/backup/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def load_arguments(self, _):
with self.argument_context('backup policy ' + command) as c:
c.argument('name', policy_name_type, options_list=['--name', '-n'], help='Name of the backup policy. You can use the backup policy list command to get the name of a policy.')

with self.argument_context('backup policy list-associated-items') as c:
c.argument('backup_management_type', backup_management_type)

with self.argument_context('backup policy set') as c:
c.argument('policy', type=file_type, help='JSON encoded policy definition. Use the show command with JSON output to obtain a policy object. Modify the values using a file editor and pass the object.', completer=FilesCompleter())
c.argument('name', options_list=['--name', '-n'], help='Name of the Policy.')
Expand Down
5 changes: 3 additions & 2 deletions src/azure-cli/azure/cli/command_modules/backup/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ def list_policies(client, resource_group_name, vault_name):
return _get_list_from_paged_response(policies)


def list_associated_items_for_policy(client, resource_group_name, vault_name, name):
def list_associated_items_for_policy(client, resource_group_name, vault_name, name, backup_management_type):
filter_string = _get_filter_string({
'policyName': name})
'policyName': name,
'backupManagementType': backup_management_type})
items = client.list(vault_name, resource_group_name, filter_string)
return _get_list_from_paged_response(items)

Expand Down
5 changes: 3 additions & 2 deletions src/azure-cli/azure/cli/command_modules/backup/custom_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ def get_default_policy_for_vm(client, resource_group_name, vault_name):
return custom.get_default_policy_for_vm(client, resource_group_name, vault_name)


def list_associated_items_for_policy(client, resource_group_name, vault_name, name):
return custom.list_associated_items_for_policy(client, resource_group_name, vault_name, name)
def list_associated_items_for_policy(client, resource_group_name, vault_name, name, backup_management_type=None):
return custom.list_associated_items_for_policy(client, resource_group_name, vault_name, name,
backup_management_type)


def unregister_container(cmd, client, vault_name, resource_group_name, container_name, backup_management_type=None):
Expand Down

0 comments on commit 72b2e89

Please sign in to comment.