-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add management groups commands to azure-cli-resource #6426
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 1 commit
ae58bff
42376be
89210ef
07e1bf3
80d08ab
972a0e6
6d06867
25e6137
9a9566c
21ddb6b
4266a02
698c379
e73a0a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1104,6 +1104,10 @@ def _get_subscription_id_from_subscription(cli_ctx, subscription): # pylint: di | |
| from azure.cli.core.util import CLIError | ||
| raise CLIError("Subscription not found in the current context.") | ||
|
|
||
| def _get_parent_id_from_parent(parent): | ||
| if parent is None or parent.startswith("/providers/Microsoft.Management/managementGroups/"): | ||
| return parent | ||
| return "/providers/Microsoft.Management/managementGroups/"+parent | ||
|
|
||
| def cli_managementgroups_group_list(cmd, client): | ||
| _register_rp(cmd.cli_ctx) | ||
|
|
@@ -1127,8 +1131,9 @@ def cli_managementgroups_group_create( | |
| client, | ||
| group_name, | ||
| display_name=None, | ||
| parent_id=None): | ||
| parent=None): | ||
| _register_rp(cmd.cli_ctx) | ||
| parent_id=_get_parent_id_from_parent(parent) | ||
| from azure.mgmt.managementgroups.models import (CreateManagementGroupRequest, CreateManagementGroupDetails, CreateParentGroupInfo) | ||
| create_parent_grp_info = CreateParentGroupInfo(id=parent_id) | ||
| create_mgmt_grp_details = CreateManagementGroupDetails(parent=create_parent_grp_info) | ||
|
|
@@ -1139,22 +1144,23 @@ def cli_managementgroups_group_create( | |
| def cli_managementgroups_group_update_custom_func( | ||
| instance, | ||
| display_name=None, | ||
| parent_id=None): | ||
| parent=None): | ||
| instance["display_name"] = display_name | ||
| instance["parent_id"] = parent_id | ||
| instance["parent"] = parent | ||
| return instance | ||
|
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. If the instance is the object, these simply become |
||
|
|
||
|
|
||
| def cli_managementgroups_group_update_get(): | ||
| update_parameters = {'display_name': None, 'parent_id': None} | ||
| update_parameters = {'display_name': None, 'parent': None} | ||
| return update_parameters | ||
|
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. Instead of creating a dictionary, you could just create the PatchManagementGroupRequest object 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. Will do. Thanks! |
||
|
|
||
|
|
||
| def cli_managementgroups_group_update_set( | ||
| cmd, client, group_name, parameters=None): | ||
| _register_rp(cmd.cli_ctx) | ||
| parent_id=_get_parent_id_from_parent(parameters["parent"]) | ||
| from azure.mgmt.managementgroups.models import PatchManagementGroupRequest | ||
| patch_mgmt_grp_request = PatchManagementGroupRequest(display_name=parameters["display_name"], parent_id=parameters["parent_id"]) | ||
| patch_mgmt_grp_request = PatchManagementGroupRequest(display_name=parameters["display_name"], parent_id=parent_id) | ||
| return client.update(group_name, patch_mgmt_grp_request) | ||
|
||
|
|
||
|
|
||
|
|
||
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.
long-summaryshould provide additional information, instead of being a duplicate ofshort-summary.