-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[ARM] Refactor deployment commands #10751
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
Changes from 27 commits
095b3f9
4caf537
c3a4b58
432c2e9
c006d43
2d6cb8d
d9863fb
87f5ff2
8572bf6
d33db76
4734036
458bbca
282710b
9c58de5
af06e49
80f9fb9
f3ea38e
0bbf8ba
16b4645
7bd0782
844ba11
c53d069
ea2b273
1dcd3dd
ff28c45
f0ce838
86e02e1
5b913c0
1da1d49
d24145c
c9080cb
5e92470
0e03020
7e37f3d
58f2a5a
1e0980c
0c1fc1f
c6a4ab5
75acad1
40a69f9
849eac9
53e18e6
b7affe8
7a6853e
f5c8c58
4f93025
e19f0ff
a808d26
302e52a
430ab92
ee17865
1e1b69b
15e6645
1d0895f
c7ad2a5
a6b8df0
2d3fbbe
ab8aac8
9753fc1
c10d6a2
65d7231
a3d3e93
3e9459f
30c4c7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,12 @@ | |
| MSI_LOCAL_ID = '[system]' | ||
|
|
||
|
|
||
| def process_deployment_create_namespace(namespace): | ||
| if bool(namespace.template_uri) == bool(namespace.template_file): | ||
| raise CLIError('incorrect usage: --template-file FILE | --template-uri URI') | ||
| _validate_deployment_name(namespace) | ||
|
|
||
|
|
||
| def _validate_deployment_name(namespace): | ||
| # If missing,try come out with a name associated with the template name | ||
| if namespace.deployment_name is None: | ||
|
|
@@ -31,12 +37,6 @@ def _validate_deployment_name(namespace): | |
| namespace.deployment_name = 'deployment1' | ||
|
|
||
|
|
||
| def process_deployment_create_namespace(namespace): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems no change this file, can you revert this change?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure. updated. |
||
| if bool(namespace.template_uri) == bool(namespace.template_file): | ||
| raise CLIError('incorrect usage: --template-file FILE | --template-uri URI') | ||
| _validate_deployment_name(namespace) | ||
|
|
||
|
|
||
| def internal_validate_lock_parameters(namespace, resource_group, resource_provider_namespace, | ||
| parent_resource_path, resource_type, resource_name): | ||
| if resource_group is None: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -218,6 +218,7 @@ def load_command_table(self, _): | |
| g.command('add-value', 'create_or_update_value') | ||
| g.command('remove-value', 'delete_value') | ||
|
|
||
| # az group deployment | ||
| with self.command_group('group deployment', resource_deployment_sdk) as g: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
will group deployment, group deployment operation be deprecated, if so, you may need to add redirect here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they will be deprecated. we'll add the deprecation info later in a separate PR. |
||
| g.custom_command('create', 'deploy_arm_template', supports_no_wait=True, validator=process_deployment_create_namespace, | ||
| table_transformer=transform_deployment, exception_handler=handle_template_based_exception) | ||
|
|
@@ -233,19 +234,86 @@ def load_command_table(self, _): | |
| g.command('list', 'list') | ||
| g.custom_show_command('show', 'get_deployment_operations', client_factory=cf_deployment_operations) | ||
|
|
||
| # az deployment | ||
| with self.command_group('deployment', resource_deployment_sdk, min_api='2018-05-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
|
Juliehzl marked this conversation as resolved.
|
||
| g.custom_command('list', 'list_deployments_at_subscription_scope', table_transformer=transform_deployments_list) | ||
| g.custom_show_command('show', 'get_deployment_at_subscription_scope') | ||
| g.custom_command('delete', 'delete_deployment_at_subscription_scope', supports_no_wait=True) | ||
| g.custom_command('validate', 'validate_arm_template_at_subscription_scope', table_transformer=deployment_validate_table_format, exception_handler=handle_template_based_exception) | ||
| g.custom_command('create', 'deploy_arm_template_at_subscription_scope', supports_no_wait=True, validator=process_deployment_create_namespace, exception_handler=handle_template_based_exception) | ||
| g.custom_command('export', 'export_subscription_deployment_template') | ||
| g.custom_wait_command('wait', 'wait_deployment_at_subscription_scope') | ||
| g.custom_command('validate', 'validate_arm_template_at_subscription_scope', validator=process_deployment_create_namespace, | ||
| table_transformer=deployment_validate_table_format, exception_handler=handle_template_based_exception) | ||
| g.custom_command('create', 'deploy_arm_template_at_subscription_scope', supports_no_wait=True, validator=process_deployment_create_namespace, | ||
| exception_handler=handle_template_based_exception) | ||
| g.custom_command('export', 'export_template_at_subscription_scope') | ||
| g.custom_wait_command('wait', 'get_deployment_at_subscription_scope') | ||
|
|
||
| with self.command_group('deployment operation', resource_deployment_operation_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
| g.custom_command('list', 'list_deployment_operations_at_subscription_scope') | ||
|
Tiano2017 marked this conversation as resolved.
|
||
| g.custom_show_command('show', 'get_deployment_operations_at_subscription_scope', client_factory=cf_deployment_operations) | ||
|
|
||
| # az deployment sub | ||
| with self.command_group('deployment sub', resource_deployment_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will prefer
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a guideline on the command group name. we discussed in our team and decided to use the short format. Let me know if that's against the guidelines. @alex-frankel FYI.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because there is existing subgroup named "operation", subscription looks more descriptive. Just my suggestion not required.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| g.custom_command('list', 'list_deployments_at_subscription_scope', table_transformer=transform_deployments_list) | ||
| g.custom_show_command('show', 'get_deployment_at_subscription_scope', table_transformer=transform_deployment) | ||
| g.custom_command('delete', 'delete_deployment_at_subscription_scope', supports_no_wait=True) | ||
| g.custom_command('validate', 'validate_arm_template_at_subscription_scope', validator=process_deployment_create_namespace, | ||
| table_transformer=deployment_validate_table_format, exception_handler=handle_template_based_exception) | ||
| g.custom_command('create', 'deploy_arm_template_at_subscription_scope', supports_no_wait=True, validator=process_deployment_create_namespace, | ||
| table_transformer=transform_deployment, exception_handler=handle_template_based_exception) | ||
| g.custom_command('export', 'export_template_at_subscription_scope') | ||
| g.custom_wait_command('wait', 'get_deployment_at_subscription_scope') | ||
|
|
||
| with self.command_group('deployment operation', resource_deployment_operation_sdk, min_api='2018-05-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
| with self.command_group('deployment operation sub', resource_deployment_operation_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks the commands in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right. that's expected. The command group
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense. will fix it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you will deprecate some commands group, please add deprecate info to them as shown in https://github.com/Azure/azure-cli/blob/dev/doc/authoring_command_modules/authoring_commands.md#deprecating-commands-and-arguments
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may I understand why az deployment operation will be retired? is there more subresource like sub in operation command group, if so, can you give an example? I ask this because if sub is already the top resource in operation, we would suggest to have it as a default resource in operation command group. In reply to: 367718352 [](ancestors = 367718352)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so |
||
| g.custom_command('list', 'list_deployment_operations_at_subscription_scope') | ||
| g.custom_show_command('show', 'get_deployment_operations_at_subscription_scope', client_factory=cf_deployment_operations) | ||
|
|
||
| # az deployment group | ||
| with self.command_group('deployment group', resource_deployment_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is no min_api in group deployment -> with self.command_group('group deployment', resource_deployment_sdk).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's not required. does it cause any issue? |
||
| g.custom_command('list', 'list_deployments_at_resource_group', table_transformer=transform_deployments_list) | ||
| g.custom_show_command('show', 'get_deployment_at_resource_group', table_transformer=transform_deployment) | ||
| g.custom_command('delete', 'delete_deployment_at_resource_group', supports_no_wait=True) | ||
| g.custom_command('validate', 'validate_arm_template_at_resource_group', validator=process_deployment_create_namespace, | ||
| table_transformer=deployment_validate_table_format, exception_handler=handle_template_based_exception) | ||
| g.custom_command('create', 'deploy_arm_template_at_resource_group', supports_no_wait=True, validator=process_deployment_create_namespace, | ||
| table_transformer=transform_deployment, exception_handler=handle_template_based_exception) | ||
| g.custom_command('export', 'export_template_at_resource_group') | ||
| g.custom_wait_command('wait', 'get_deployment_at_resource_group') | ||
|
|
||
| with self.command_group('deployment operation group', resource_deployment_operation_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
| g.custom_command('list', 'list_deployment_operations_at_resource_group') | ||
| g.custom_show_command('show', 'get_deployment_operations_at_resource_group', client_factory=cf_deployment_operations) | ||
|
|
||
| # az deployment mg | ||
| with self.command_group('deployment mg', resource_deployment_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
| g.custom_command('list', 'list_deployments_at_management_group', table_transformer=transform_deployments_list) | ||
| g.custom_show_command('show', 'get_deployment_at_management_group', table_transformer=transform_deployment) | ||
| g.custom_command('delete', 'delete_deployment_at_management_group', supports_no_wait=True) | ||
| g.custom_command('validate', 'validate_arm_template_at_management_group', validator=process_deployment_create_namespace, | ||
| table_transformer=deployment_validate_table_format, exception_handler=handle_template_based_exception) | ||
| g.custom_command('create', 'deploy_arm_template_at_management_group', supports_no_wait=True, validator=process_deployment_create_namespace, | ||
| table_transformer=transform_deployment, exception_handler=handle_template_based_exception) | ||
| g.custom_command('export', 'export_template_at_management_group') | ||
| g.custom_wait_command('wait', 'get_deployment_at_management_group') | ||
|
|
||
| with self.command_group('deployment operation mg', resource_deployment_operation_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
| g.custom_command('list', 'list_deployment_operations_at_management_group') | ||
| g.custom_show_command('show', 'get_deployment_operations_at_management_group', client_factory=cf_deployment_operations) | ||
|
|
||
| # az deployment tenant | ||
| with self.command_group('deployment tenant', resource_deployment_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
| g.custom_command('list', 'list_deployments_at_tenant_scope', table_transformer=transform_deployments_list) | ||
| g.custom_show_command('show', 'get_deployment_at_tenant_scope', table_transformer=transform_deployment) | ||
| g.custom_command('delete', 'delete_deployment_at_tenant_scope', supports_no_wait=True) | ||
| g.custom_command('validate', 'validate_arm_template_at_tenant_scope', validator=process_deployment_create_namespace, | ||
| table_transformer=deployment_validate_table_format, exception_handler=handle_template_based_exception) | ||
| g.custom_command('create', 'deploy_arm_template_at_tenant_scope', supports_no_wait=True, validator=process_deployment_create_namespace, | ||
| table_transformer=transform_deployment, exception_handler=handle_template_based_exception) | ||
| g.custom_command('export', 'export_template_at_tenant_scope') | ||
| g.custom_wait_command('wait', 'get_deployment_at_tenant_scope') | ||
|
|
||
| with self.command_group('deployment operation tenant', resource_deployment_operation_sdk, min_api='2019-07-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) as g: | ||
| g.custom_command('list', 'list_deployment_operations_at_tenant_scope') | ||
| g.custom_show_command('show', 'get_deployment_operations_at_tenant_scope', client_factory=cf_deployment_operations) | ||
|
|
||
| with self.command_group('policy assignment', resource_type=ResourceType.MGMT_RESOURCE_POLICY) as g: | ||
| g.custom_command('create', 'create_policy_assignment') | ||
| g.custom_command('delete', 'delete_policy_assignment') | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.