Skip to content

Commit

Permalink
{Mangedservices} Migrate managedservices to AAZ (#29744)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jing-song authored Sep 3, 2024
1 parent d09154d commit 0f4aefd
Show file tree
Hide file tree
Showing 26 changed files with 2,826 additions and 324 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# --------------------------------------------------------------------------------------------

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


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

def load_command_table(self, args):
from .commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
except ImportError:
aaz = None
if aaz:
load_aaz_command_table(
loader=self,
aaz_pkg_name=aaz.__name__,
args=args
)
load_command_table(self, args)
return self.command_table

Expand Down

This file was deleted.

134 changes: 0 additions & 134 deletions src/azure-cli/azure/cli/command_modules/managedservices/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,137 +5,3 @@
# --------------------------------------------------------------------------------------------

from knack.help_files import helps # pylint: disable=unused-import
# pylint: disable=line-too-long, too-many-lines

helps['managedservices'] = """
type: group
short-summary: Manage the registration assignments and definitions in Azure.
"""

helps['managedservices assignment'] = """
type: group
short-summary: Manage the registration assignments in Azure.
"""

helps['managedservices assignment create'] = """
type: command
short-summary: Creates a new registration assignment.
parameters:
- name: --definition
short-summary: |
The fully qualified resource id of the registration definition.
- name: --assignment-id
short-summary: |
Can be used to override the generated registration assignment id.
examples:
- name: Create an assignment under the default subscription scope.
text: az managedservices assignment create --definition "/subscriptions/a62076fa-768a-403c-9d9d-6a9919aae441/providers/Microsoft.ManagedServices/registrationDefinitions/0c3e9687-b461-4615-b6e4-74d54998d6e4"
- name: Create an assignment under a given resource group scope.
text: az managedservices assignment create --definition "/subscriptions/a62076fa-768a-403c-9d9d-6a9919aae441/providers/Microsoft.ManagedServices/registrationDefinitions/0c3e9687-b461-4615-b6e4-74d54998d6e4" --resource-group mygroup
"""

helps['managedservices assignment delete'] = """
type: command
short-summary: Deletes the registration assignment.
examples:
- name: Deletes an assignment given its identifier under the default subscription scope.
text: az managedservices assignment delete --assignment d3087cf0-e180-4cca-b147-54ae00c7b504
- name: Deletes an assignment given its fully qualified resource id.
text: az managedservices assignment delete --assignment /subscriptions/a62076fa-768a-403c-9d9d-6a9919aae441/providers/Microsoft.ManagedServices/registrationAssignments/0c3e9687-b461-4615-b6e4-74d54998d6e4
"""

helps['managedservices assignment list'] = """
type: command
short-summary: List all the registration assignments.
examples:
- name: Lists all the registration assignments under the default scope.
text: az managedservices assignment list
- name: Lists all the registration assignments under the given resource group.
text: az managedservices assignment list --resource-group mygroup
- name: Lists all the registration assignments under the default scope along with the associated registration definition details.
text: az managedservices assignment list --include-definition true
"""

helps['managedservices assignment show'] = """
type: command
short-summary: Gets a registration assignment.
examples:
- name: Get an assignment given its identifier under the default subscription scope.
text: az managedservices assignment show --assignment d3087cf0-e180-4cca-b147-54ae00c7b504
- name: Get an assignment given its fully qualified resource id.
text: az managedservices assignment show --assignment /subscriptions/a62076fa-768a-403c-9d9d-6a9919aae441/providers/Microsoft.ManagedServices/registrationAssignments/0c3e9687-b461-4615-b6e4-74d54998d6e4
- name: Get an assignment given its identifier under the default subscription scope with the registration definition details.
text: az managedservices assignment show --assignment d3087cf0-e180-4cca-b147-54ae00c7b504 --include-definition true
"""

helps['managedservices definition'] = """
type: group
short-summary: Manage the registration definitions in Azure.
"""

helps['managedservices definition create'] = """
type: command
short-summary: Creates a new registration definition.
parameters:
- name: --name
short-summary: |
The name of the registration definition.
- name: --tenant-id
short-summary: |
The managed by tenant id.
- name: --principal-id
short-summary: |
The principal id.
- name: --role-definition-id
short-summary: |
The role definition id.
- name: --description
short-summary: |
The friendly description.
- name: --plan-name
short-summary: |
The plan name.
- name: --plan-product
short-summary: |
The plan product.
- name: --plan-publisher
short-summary: |
The plan publisher.
- name: --plan-version
short-summary: |
The plan version.
- name: --definition-id
short-summary: |
Can be used to override the generated registration definition id.
examples:
- name: Creates a registration definition under the default subscription scope with the required parameters.
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
"""

helps['managedservices definition delete'] = """
type: command
short-summary: Deletes a registration.
examples:
- name: Deletes the registration definition given its identifier under the default subscription scope.
text: az managedservices definition delete --definition af8772a0-fd9c-4ddc-8ad0-7d4b3913d7dd
- name: Deletes the registration definition given its fully qualified resource id.
text: az managedservices definition delete --definition /subscriptions/39033314-9b39-4c7b-84fd-0e26e55f15dc/providers/Microsoft.ManagedServices/registrationDefinitions/1d693e4f-9e79-433a-b3a2-afce1f8b61ec
"""

helps['managedservices definition list'] = """
type: command
short-summary: List all the registration definitions under the default scope or under the subscription provided.
examples:
- name: Lists all the registration definitions under the default subscription scope.
text: az managedservices definition list
"""

helps['managedservices definition show'] = """
type: command
short-summary: Gets a registration definition.
examples:
- name: Gets the registration definition given its identifier under the default subscription scope.
text: az managedservices definition show --definition af8772a0-fd9c-4ddc-8ad0-7d4b3913d7dd
- name: Gets the registration definition given its fully qualified resource id.
text: az managedservices definition show --definition /subscriptions/39033314-9b39-4c7b-84fd-0e26e55f15dc/providers/Microsoft.ManagedServices/registrationDefinitions/1d693e4f-9e79-433a-b3a2-afce1f8b61ec
"""
20 changes: 2 additions & 18 deletions src/azure-cli/azure/cli/command_modules/managedservices/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,5 @@
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long

from azure.cli.core.commands.parameters import get_three_state_flag


def load_arguments(self, _):

for item in ['managedservices definition show', 'managedservices definition delete']:
with self.argument_context(item) as c:
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.')

for item in ['managedservices assignment list', 'managedservices assignment show']:
with self.argument_context(item) as c:
c.argument('include_definition', arg_type=get_three_state_flag(),
help='When provided, gets the associated registration definition details.')

for item in ['managedservices assignment show', 'managedservices assignment delete']:
with self.argument_context(item) as c:
c.argument('assignment',
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.')
def load_arguments(self, _): # pylint: disable=unused-argument
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"managedservices",
)
class __CMDGroup(AAZCommandGroup):
"""Manage the registration assignments and definitions in Azure.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from azure.cli.core.aaz import *


@register_command_group(
"managedservices assignment",
)
class __CMDGroup(AAZCommandGroup):
"""Manage the registration assignments in Azure.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# --------------------------------------------------------------------------------------------
# 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 aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

from .__cmd_group import *
from ._create import *
from ._delete import *
from ._list import *
from ._show import *
from ._wait import *
Loading

0 comments on commit 0f4aefd

Please sign in to comment.