Skip to content

Commit 0f4aefd

Browse files
authored
{Mangedservices} Migrate managedservices to AAZ (#29744)
1 parent d09154d commit 0f4aefd

File tree

26 files changed

+2826
-324
lines changed

26 files changed

+2826
-324
lines changed

src/azure-cli/azure/cli/command_modules/managedservices/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# --------------------------------------------------------------------------------------------
55

66
from azure.cli.core import AzCommandsLoader
7-
from azure.cli.core.profiles import ResourceType
87
from azure.cli.command_modules.managedservices._help import helps # pylint: disable=unused-import
98

109

@@ -14,11 +13,21 @@ def __init__(self, cli_ctx=None):
1413
from azure.cli.core.commands import CliCommandType
1514
managedservices_custom = CliCommandType(operations_tmpl='azure.cli.command_modules.managedservices.custom#{}')
1615
super(ManagedServicesCommandsLoader, self).__init__(cli_ctx=cli_ctx,
17-
resource_type=ResourceType.MGMT_MANAGEDSERVICES,
1816
custom_command_type=managedservices_custom)
1917

2018
def load_command_table(self, args):
2119
from .commands import load_command_table
20+
from azure.cli.core.aaz import load_aaz_command_table
21+
try:
22+
from . import aaz
23+
except ImportError:
24+
aaz = None
25+
if aaz:
26+
load_aaz_command_table(
27+
loader=self,
28+
aaz_pkg_name=aaz.__name__,
29+
args=args
30+
)
2231
load_command_table(self, args)
2332
return self.command_table
2433

src/azure-cli/azure/cli/command_modules/managedservices/_client_factory.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/azure-cli/azure/cli/command_modules/managedservices/_help.py

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -5,137 +5,3 @@
55
# --------------------------------------------------------------------------------------------
66

77
from knack.help_files import helps # pylint: disable=unused-import
8-
# pylint: disable=line-too-long, too-many-lines
9-
10-
helps['managedservices'] = """
11-
type: group
12-
short-summary: Manage the registration assignments and definitions in Azure.
13-
"""
14-
15-
helps['managedservices assignment'] = """
16-
type: group
17-
short-summary: Manage the registration assignments in Azure.
18-
"""
19-
20-
helps['managedservices assignment create'] = """
21-
type: command
22-
short-summary: Creates a new registration assignment.
23-
parameters:
24-
- name: --definition
25-
short-summary: |
26-
The fully qualified resource id of the registration definition.
27-
- name: --assignment-id
28-
short-summary: |
29-
Can be used to override the generated registration assignment id.
30-
examples:
31-
- name: Create an assignment under the default subscription scope.
32-
text: az managedservices assignment create --definition "/subscriptions/a62076fa-768a-403c-9d9d-6a9919aae441/providers/Microsoft.ManagedServices/registrationDefinitions/0c3e9687-b461-4615-b6e4-74d54998d6e4"
33-
- name: Create an assignment under a given resource group scope.
34-
text: az managedservices assignment create --definition "/subscriptions/a62076fa-768a-403c-9d9d-6a9919aae441/providers/Microsoft.ManagedServices/registrationDefinitions/0c3e9687-b461-4615-b6e4-74d54998d6e4" --resource-group mygroup
35-
"""
36-
37-
helps['managedservices assignment delete'] = """
38-
type: command
39-
short-summary: Deletes the registration assignment.
40-
examples:
41-
- name: Deletes an assignment given its identifier under the default subscription scope.
42-
text: az managedservices assignment delete --assignment d3087cf0-e180-4cca-b147-54ae00c7b504
43-
- name: Deletes an assignment given its fully qualified resource id.
44-
text: az managedservices assignment delete --assignment /subscriptions/a62076fa-768a-403c-9d9d-6a9919aae441/providers/Microsoft.ManagedServices/registrationAssignments/0c3e9687-b461-4615-b6e4-74d54998d6e4
45-
"""
46-
47-
helps['managedservices assignment list'] = """
48-
type: command
49-
short-summary: List all the registration assignments.
50-
examples:
51-
- name: Lists all the registration assignments under the default scope.
52-
text: az managedservices assignment list
53-
- name: Lists all the registration assignments under the given resource group.
54-
text: az managedservices assignment list --resource-group mygroup
55-
- name: Lists all the registration assignments under the default scope along with the associated registration definition details.
56-
text: az managedservices assignment list --include-definition true
57-
"""
58-
59-
helps['managedservices assignment show'] = """
60-
type: command
61-
short-summary: Gets a registration assignment.
62-
examples:
63-
- name: Get an assignment given its identifier under the default subscription scope.
64-
text: az managedservices assignment show --assignment d3087cf0-e180-4cca-b147-54ae00c7b504
65-
- name: Get an assignment given its fully qualified resource id.
66-
text: az managedservices assignment show --assignment /subscriptions/a62076fa-768a-403c-9d9d-6a9919aae441/providers/Microsoft.ManagedServices/registrationAssignments/0c3e9687-b461-4615-b6e4-74d54998d6e4
67-
- name: Get an assignment given its identifier under the default subscription scope with the registration definition details.
68-
text: az managedservices assignment show --assignment d3087cf0-e180-4cca-b147-54ae00c7b504 --include-definition true
69-
"""
70-
71-
helps['managedservices definition'] = """
72-
type: group
73-
short-summary: Manage the registration definitions in Azure.
74-
"""
75-
76-
helps['managedservices definition create'] = """
77-
type: command
78-
short-summary: Creates a new registration definition.
79-
parameters:
80-
- name: --name
81-
short-summary: |
82-
The name of the registration definition.
83-
- name: --tenant-id
84-
short-summary: |
85-
The managed by tenant id.
86-
- name: --principal-id
87-
short-summary: |
88-
The principal id.
89-
- name: --role-definition-id
90-
short-summary: |
91-
The role definition id.
92-
- name: --description
93-
short-summary: |
94-
The friendly description.
95-
- name: --plan-name
96-
short-summary: |
97-
The plan name.
98-
- name: --plan-product
99-
short-summary: |
100-
The plan product.
101-
- name: --plan-publisher
102-
short-summary: |
103-
The plan publisher.
104-
- name: --plan-version
105-
short-summary: |
106-
The plan version.
107-
- name: --definition-id
108-
short-summary: |
109-
Can be used to override the generated registration definition id.
110-
examples:
111-
- name: Creates a registration definition under the default subscription scope with the required parameters.
112-
text: az managedservices definition create --name mydef --tenant-id dab3375b-6197-4a15-a44b-16c41faa91d7 --principal-id b6f6c88a-5b7a-455e-ba40-ce146d4d3671 --role-definition-id ccdd72a7-3385-48ef-bd42-f606fba81ae7
113-
"""
114-
115-
helps['managedservices definition delete'] = """
116-
type: command
117-
short-summary: Deletes a registration.
118-
examples:
119-
- name: Deletes the registration definition given its identifier under the default subscription scope.
120-
text: az managedservices definition delete --definition af8772a0-fd9c-4ddc-8ad0-7d4b3913d7dd
121-
- name: Deletes the registration definition given its fully qualified resource id.
122-
text: az managedservices definition delete --definition /subscriptions/39033314-9b39-4c7b-84fd-0e26e55f15dc/providers/Microsoft.ManagedServices/registrationDefinitions/1d693e4f-9e79-433a-b3a2-afce1f8b61ec
123-
"""
124-
125-
helps['managedservices definition list'] = """
126-
type: command
127-
short-summary: List all the registration definitions under the default scope or under the subscription provided.
128-
examples:
129-
- name: Lists all the registration definitions under the default subscription scope.
130-
text: az managedservices definition list
131-
"""
132-
133-
helps['managedservices definition show'] = """
134-
type: command
135-
short-summary: Gets a registration definition.
136-
examples:
137-
- name: Gets the registration definition given its identifier under the default subscription scope.
138-
text: az managedservices definition show --definition af8772a0-fd9c-4ddc-8ad0-7d4b3913d7dd
139-
- name: Gets the registration definition given its fully qualified resource id.
140-
text: az managedservices definition show --definition /subscriptions/39033314-9b39-4c7b-84fd-0e26e55f15dc/providers/Microsoft.ManagedServices/registrationDefinitions/1d693e4f-9e79-433a-b3a2-afce1f8b61ec
141-
"""

src/azure-cli/azure/cli/command_modules/managedservices/_params.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,5 @@
44
# --------------------------------------------------------------------------------------------
55
# pylint: disable=line-too-long
66

7-
from azure.cli.core.commands.parameters import get_three_state_flag
8-
9-
10-
def load_arguments(self, _):
11-
12-
for item in ['managedservices definition show', 'managedservices definition delete']:
13-
with self.argument_context(item) as c:
14-
c.argument('definition', help='The identifier (guid) or the fully qualified resource id of the registration definition. When resource id is used, subscription id and resource group parameters are ignored.')
15-
16-
for item in ['managedservices assignment list', 'managedservices assignment show']:
17-
with self.argument_context(item) as c:
18-
c.argument('include_definition', arg_type=get_three_state_flag(),
19-
help='When provided, gets the associated registration definition details.')
20-
21-
for item in ['managedservices assignment show', 'managedservices assignment delete']:
22-
with self.argument_context(item) as c:
23-
c.argument('assignment',
24-
help='The identifier (guid) or the fully qualified resource id of the registration assignment. When resource id is used, subscription id and resource group parameters are ignored.')
7+
def load_arguments(self, _): # pylint: disable=unused-argument
8+
pass
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"managedservices",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage the registration assignments and definitions in Azure.
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command_group(
15+
"managedservices assignment",
16+
)
17+
class __CMDGroup(AAZCommandGroup):
18+
"""Manage the registration assignments in Azure.
19+
"""
20+
pass
21+
22+
23+
__all__ = ["__CMDGroup"]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from .__cmd_group import *
12+
from ._create import *
13+
from ._delete import *
14+
from ._list import *
15+
from ._show import *
16+
from ._wait import *

0 commit comments

Comments
 (0)