-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Adding the az managementgroup extension for Management Groups #4198
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
Closed
git-thomasdolan
wants to merge
29
commits into
Azure:main
from
git-thomasdolan:thomasdolan/old_swagger_test
Closed
Changes from 17 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
301c52c
Commiting new managementgroup cli extension in the forked az-cli repo…
git-thomasdolan 0aecb69
Working version, ready to submit PR into Azure CLI repo
git-thomasdolan 64a6029
Committing files that were changed that did not appear in the previou…
git-thomasdolan 62caf25
Removing managementgroups/src/managementgroup directory that I accide…
git-thomasdolan 4d03fb2
Re-ran recordings to show that no errors took place
git-thomasdolan 616dab5
Ran tests again so they pass in record mode
git-thomasdolan b55defa
Shorted variable names so it would pass linter, fix scenario tests as…
git-thomasdolan ff65c0a
Added ManagementGroup to service_name.json
git-thomasdolan 06147ef
Merge branch 'main' into thomasdolan/old_swagger_test
git-thomasdolan e273b3f
Passed style check
git-thomasdolan 25015cd
Merge branch 'thomasdolan/old_swagger_test' of https://github.com/git…
git-thomasdolan 96bb751
Removed redunant tests
git-thomasdolan c5418de
Update service_name.json
git-thomasdolan 8acc274
Update CODEOWNERS
git-thomasdolan c867321
Update README.md
git-thomasdolan 8456350
Merge https://github.com/Azure/azure-cli-extensions into thomasdolan/…
git-thomasdolan a87d723
Merge branch 'main' into thomasdolan/old_swagger_test
git-thomasdolan 501fae8
Added unit tests for management-group-subscription and hierarchy-setting
git-thomasdolan c2a19cc
Updating local repo with remote
git-thomasdolan 8e9931f
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 967ec64
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 2af1d70
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 1e5c085
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 0016c90
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 8cfc04c
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 16088c8
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 7f0e39f
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan fb9f63c
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 029b606
Update src/managementgroup/azext_managementgroup/generated/_help.py
git-thomasdolan 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -219,3 +219,5 @@ | |
| /src/image-gallery/ @zhoxing-ms | ||
|
|
||
| /src/init/ @zhoxing-ms @HuangYT2000 | ||
|
|
||
| /src/managementgroup/ @kairu-ms | ||
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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .. :changelog: | ||
|
|
||
| Release History | ||
| =============== | ||
|
|
||
| 0.1.0 | ||
| ++++++ | ||
| * Initial release. |
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 |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Azure CLI managementgroup Extension # | ||
| This is the extension for managementgroup | ||
|
|
||
| ### How to use ### | ||
| Install this extension using the below CLI command | ||
| ``` | ||
| az extension add --name managementgroup | ||
| ``` | ||
|
|
||
| ### Included Features ### | ||
| #### managementgroup management-group #### | ||
| ##### Create ##### | ||
| ``` | ||
| az managementgroup management-group create --display-name "ChildGroup" \ | ||
| --id "/providers/Microsoft.Management/managementGroups/ParentGroup" --group-id "ChildGroup" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az managementgroup management-group show --group-id "20000000-0001-0000-0000-000000000000" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az managementgroup management-group show --expand "ancestors" --group-id "20000000-0001-0000-0000-00000000000" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az managementgroup management-group show --expand "children" --group-id "20000000-0001-0000-0000-000000000000" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az managementgroup management-group show --expand "path" --group-id "20000000-0001-0000-0000-000000000000" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az managementgroup management-group show --expand "children" --recurse true \ | ||
| --group-id "20000000-0001-0000-0000-000000000000" | ||
| ``` | ||
|
Comment on lines
+17
to
+37
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.
Could we have a more detailed description of this title, or could we put similar contents together under one title |
||
| ##### List ##### | ||
| ``` | ||
| az managementgroup management-group list | ||
| ``` | ||
| ##### Update ##### | ||
| ``` | ||
| az managementgroup management-group update --group-id "ChildGroup" --display-name "AlternateDisplayName" \ | ||
| --parent-group-id "/providers/Microsoft.Management/managementGroups/AlternateParentGroup" | ||
| ``` | ||
| ##### Show-descendant ##### | ||
| ``` | ||
| az managementgroup management-group show-descendant --group-id "20000000-0000-0000-0000-000000000000" | ||
| ``` | ||
| ##### Delete ##### | ||
| ``` | ||
| az managementgroup management-group delete --group-id "GroupToDelete" | ||
| ``` | ||
| #### managementgroup management-group-subscription #### | ||
| ##### Create ##### | ||
| ``` | ||
| az managementgroup management-group-subscription create --group-id "Group" \ | ||
| --subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc" | ||
| ``` | ||
| ##### Show-subscription ##### | ||
| ``` | ||
| az managementgroup management-group-subscription show-subscription --group-id "Group" \ | ||
| --subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc" | ||
| ``` | ||
| ##### Show-subscription-under-management-group ##### | ||
| ``` | ||
| az managementgroup management-group-subscription show-subscription-under-management-group --group-id "Group" | ||
| ``` | ||
| ##### Delete ##### | ||
| ``` | ||
| az managementgroup management-group-subscription delete --group-id "Group" \ | ||
| --subscription-id "728bcbe4-8d56-4510-86c2-4921b8beefbc" | ||
| ``` | ||
| #### managementgroup hierarchy-setting #### | ||
| ##### Create ##### | ||
| ``` | ||
| az managementgroup hierarchy-setting create --group-id "root" | ||
| ``` | ||
| ##### Show ##### | ||
| ``` | ||
| az managementgroup hierarchy-setting show --group-id "root" | ||
| ``` | ||
| ##### List ##### | ||
| ``` | ||
| az managementgroup hierarchy-setting list --group-id "root" | ||
| ``` | ||
| ##### Update ##### | ||
| ``` | ||
| az managementgroup hierarchy-setting update --group-id "root" | ||
| ``` | ||
| ##### Delete ##### | ||
| ``` | ||
| az managementgroup hierarchy-setting delete --group-id "root" | ||
| ``` | ||
| #### managementgroup #### | ||
| ##### Start-tenant-backfill ##### | ||
| ``` | ||
| az managementgroup start-tenant-backfill | ||
| ``` | ||
| ##### Tenant-backfill-status ##### | ||
| ``` | ||
| az managementgroup tenant-backfill-status | ||
| ``` | ||
| #### managementgroup entity #### | ||
| ##### List ##### | ||
| ``` | ||
| az managementgroup entity list | ||
| ``` | ||
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 |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| # pylint: disable=unused-import | ||
|
|
||
| import azext_managementgroup._help | ||
| from azure.cli.core import AzCommandsLoader | ||
|
|
||
|
|
||
| class ManagementGroupsAPICommandsLoader(AzCommandsLoader): | ||
|
|
||
| def __init__(self, cli_ctx=None): | ||
| from azure.cli.core.commands import CliCommandType | ||
| from azext_managementgroup.generated._client_factory import cf_managementgroup_cl | ||
| managementgroup_custom = CliCommandType( | ||
| operations_tmpl='azext_managementgroup.custom#{}', | ||
| client_factory=cf_managementgroup_cl) | ||
| parent = super(ManagementGroupsAPICommandsLoader, self) | ||
| parent.__init__(cli_ctx=cli_ctx, custom_command_type=managementgroup_custom) | ||
|
|
||
| def load_command_table(self, args): | ||
| from azext_managementgroup.generated.commands import load_command_table | ||
| load_command_table(self, args) | ||
| try: | ||
| from azext_managementgroup.manual.commands import load_command_table as load_command_table_manual | ||
| load_command_table_manual(self, args) | ||
| except ImportError as e: | ||
| if e.name.endswith('manual.commands'): | ||
| pass | ||
| else: | ||
| raise e | ||
| return self.command_table | ||
|
|
||
| def load_arguments(self, command): | ||
| from azext_managementgroup.generated._params import load_arguments | ||
| load_arguments(self, command) | ||
| try: | ||
| from azext_managementgroup.manual._params import load_arguments as load_arguments_manual | ||
| load_arguments_manual(self, command) | ||
| except ImportError as e: | ||
| if e.name.endswith('manual._params'): | ||
| pass | ||
| else: | ||
| raise e | ||
|
|
||
|
|
||
| COMMAND_LOADER_CLS = ManagementGroupsAPICommandsLoader |
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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
| # pylint: disable=unused-import | ||
| from .generated._help import helps # pylint: disable=reimported | ||
| try: | ||
| from .manual._help import helps # pylint: disable=reimported | ||
| except ImportError as e: | ||
| if e.name.endswith('manual._help'): | ||
| pass | ||
| else: | ||
| raise e |
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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
|
|
||
| from .generated.action import * # noqa: F403 | ||
| try: | ||
| from .manual.action import * # noqa: F403 | ||
| except ImportError as e: | ||
| if e.name.endswith('manual.action'): | ||
| pass | ||
| else: | ||
| raise e |
4 changes: 4 additions & 0 deletions
4
src/managementgroup/azext_managementgroup/azext_metadata.json
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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "azext.isExperimental": true, | ||
| "azext.minCliCoreVersion": "2.15.0" | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
| # pylint: disable=wildcard-import | ||
| # pylint: disable=unused-wildcard-import | ||
|
|
||
| from .generated.custom import * # noqa: F403 | ||
| try: | ||
| from .manual.custom import * # noqa: F403 | ||
| except ImportError as e: | ||
| if e.name.endswith('manual.custom'): | ||
| pass | ||
| else: | ||
| raise e |
12 changes: 12 additions & 0 deletions
12
src/managementgroup/azext_managementgroup/generated/__init__.py
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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # coding=utf-8 | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| __path__ = __import__('pkgutil').extend_path(__path__, __name__) |
34 changes: 34 additions & 0 deletions
34
src/managementgroup/azext_managementgroup/generated/_client_factory.py
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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for | ||
| # license information. | ||
| # | ||
| # Code generated by Microsoft (R) AutoRest Code Generator. | ||
| # Changes may cause incorrect behavior and will be lost if the code is | ||
| # regenerated. | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| def cf_managementgroup_cl(cli_ctx, *_): | ||
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
| from azext_managementgroup.vendored_sdks.managementgroup import ManagementGroupsAPI | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ManagementGroupsAPI, | ||
| subscription_bound=False, | ||
| base_url_bound=True) | ||
|
|
||
|
|
||
| def cf_management_group(cli_ctx, *_): | ||
| return cf_managementgroup_cl(cli_ctx).management_groups | ||
|
|
||
|
|
||
| def cf_management_group_subscription(cli_ctx, *_): | ||
| return cf_managementgroup_cl(cli_ctx).management_group_subscriptions | ||
|
|
||
|
|
||
| def cf_hierarchy_setting(cli_ctx, *_): | ||
| return cf_managementgroup_cl(cli_ctx).hierarchy_settings | ||
|
|
||
|
|
||
| def cf_entity(cli_ctx, *_): | ||
| return cf_managementgroup_cl(cli_ctx).entities |
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.
@git-thomasdolan Just out of curiosity, is this extension the owned by your team or Azure CLI team?
If your team is responsible for it's development and maintenance, the owner should be a member from your team
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.
Since I generated the commands, I can put myself as an owner