Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for az lock update. #2702

Merged
merged 1 commit into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
type: group
short-summary: Manage Azure locks.
"""
helps['lock update'] = """
Copy link
Member

@tjprescott tjprescott Apr 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the YAML format like the rest of the entries in the file. I'm actually kind of surprised it doesn't throw an error. The long description piece would be a good place to note that locks can apply to a subscription/resource group/resource.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up: it does throw an error. That's your CI error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. (as an end-user, I found the syntax/errors are semi-inscrutable fwiw)

type: command
short-summary: Update the properties of a lock.
parameters:
- name: --notes
type: string
short-summary: 'Notes about this lock'
examples:
- name: Update a subscription level lock with new notes
text: >
az lock update --name lockName --resource-group group --notes newNotesHere
"""
helps['policy'] = """
type: group
short-summary: Manage resource policies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
register_cli_argument('tag', 'tag_value', options_list=('--value',))

register_cli_argument('lock', 'name', options_list=('--name', '-n'))
register_cli_argument('lock create', 'level', options_list=('--lock-type', '-t'), required=True, **enum_choice_list(LockLevel))
register_cli_argument('lock', 'level', options_list=('--lock-type', '-t'), **enum_choice_list(LockLevel))
register_cli_argument('lock', 'parent_resource_path', resource_parent_type)
register_cli_argument('lock', 'resource_provider_namespace', resource_namespace_type)
register_cli_argument('lock', 'resource_type', arg_type=resource_type_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,15 +647,14 @@ def _update_lock_parameters(parameters, level, notes, lock_id, lock_type):
if lock_type is not None:
parameters.type = lock_type

def update_lock(name, resource_group_name=None,
level=None, notes=None, lock_id=None, lock_type=None):
def update_lock(name, resource_group_name=None, level=None, notes=None):
lock_client = _resource_lock_client_factory()
if resource_group_name is None:
params = lock_client.management_locks.get(name)
_update_lock_parameters(params, level, notes, lock_id, lock_type)
_update_lock_parameters(params, level, notes, None, None)
return lock_client.management_locks.create_or_update_at_subscription_level(name, params)
params = lock_client.management_locks.get_at_resource_group_level(resource_group_name, name)
_update_lock_parameters(params, level, notes, lock_id, lock_type)
_update_lock_parameters(params, level, notes, None, None)
return lock_client.management_locks.create_or_update_at_resource_group_level(
resource_group_name, name, params)

Expand Down