-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[ARM] az group export: Add new parameters --skip-resource-name-params and --skip-all-params to support skip parameterization
#13558
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
00b9235
{Docs} Remove stale reference in README to closed issue about extensi…
dkmiller ab16df0
Merge remote-tracking branch 'upstream/release'
azclibot 03436bc
Merge remote-tracking branch 'upstream/release'
azclibot dc510d6
added new export options
jorgecotillo b9b8fb6
fixed parameter reference
jorgecotillo 20b80e4
renamed argument
jorgecotillo 2518451
unit tests
jorgecotillo 15003b5
fixed style issues
jorgecotillo 7d98b1f
Merge remote-tracking branch 'upstream/release'
azclibot 422e831
reverted launch.json and updated based on feedback
jorgecotillo c06cdb4
added validation to skip params
jorgecotillo 6d683f0
updated recordings
jorgecotillo 4061af8
renamed test cases'
jorgecotillo c112ce2
Merge branch 'master' of https://github.com/Azure/azure-cli into dev
jorgecotillo d78eb48
Merge branch 'dev' of https://github.com/Azure/azure-cli into dev
jorgecotillo 90cc75f
fixed api version
jorgecotillo 29e3df8
Merge branch 'dev' of https://github.com/Azure/azure-cli into dev
jorgecotillo ad96692
updated based on feedback
jorgecotillo 497020f
removed str reference from param
jorgecotillo 2f8a565
check index zero array
jorgecotillo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1032,11 +1032,14 @@ def update_resource_group(instance, tags=None): | |
|
|
||
|
|
||
| def export_group_as_template( | ||
| cmd, resource_group_name, include_comments=False, include_parameter_default_value=False): | ||
| cmd, resource_group_name, include_comments=False, include_parameter_default_value=False, resource_ids=None, skip_resource_name_params=False, skip_all_params=False): | ||
| """Captures a resource group as a template. | ||
| :param str resource_group_name:the name of the resoruce group. | ||
| :param bool include_comments:export template with comments. | ||
| :param str resource_group_name: the name of the resource group. | ||
| :param resource_ids: space-separated resource ids to filter the export by. To export all resources, do not specify this argument or supply "*". | ||
| :param bool include_comments: export template with comments. | ||
| :param bool include_parameter_default_value: export template parameter with default value. | ||
| :param bool skip_resource_name_params: export template and skip resource name parameterization. | ||
| :param bool skip_all_params: export template parameter and skip all parameterization. | ||
|
Comment on lines
+1041
to
+1042
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. For these parameters, I will recommend you to add them as
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. done. |
||
| """ | ||
| rcf = _resource_client_factory(cmd.cli_ctx) | ||
|
|
||
|
|
@@ -1045,10 +1048,24 @@ def export_group_as_template( | |
| export_options.append('IncludeComments') | ||
| if include_parameter_default_value: | ||
| export_options.append('IncludeParameterDefaultValue') | ||
| if skip_resource_name_params: | ||
| export_options.append('SkipResourceNameParameterization') | ||
| if skip_all_params: | ||
| export_options.append('SkipAllParameterization') | ||
|
|
||
| resources = [] | ||
| if resource_ids is None or resource_ids[0] == "*": | ||
| resources = ["*"] | ||
| else: | ||
| for i in resource_ids: | ||
| if is_valid_resource_id(i): | ||
| resources.append(i) | ||
| else: | ||
| raise CLIError('az resource: error: argument --resource-ids: invalid ResourceId value: \'%s\'' % i) | ||
|
|
||
| options = ','.join(export_options) if export_options else None | ||
|
|
||
| result = rcf.resource_groups.export_template(resource_group_name, ['*'], options=options) | ||
| result = rcf.resource_groups.export_template(resource_group_name, resources, options=options) | ||
|
|
||
| # pylint: disable=no-member | ||
| # On error, server still returns 200, with details in the error attribute | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we register all new arguments in _params.py? Especially for
--resource-ids, which should be an array, right?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, had to add nargs to the param.