Skip to content
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

Adding managed identity subcommands and moving old identity commands to new subgroup #6427

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/communication/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

2.0.0
++++++
* Adding managed identity support for resource management

1.6.0
++++++
* Update Rooms sdk version to 1.0.0b3
Expand Down
21 changes: 14 additions & 7 deletions src/communication/azext_communication/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from azure.cli.core import AzCommandsLoader
from azure.cli.core.commands import AzCommandGroup
from azext_communication.generated._help import helps # pylint: disable=unused-import
try:
from azext_communication.manual._help import helps # pylint: disable=reimported
except ImportError:
Expand All @@ -21,27 +20,35 @@ class CommunicationServiceManagementClientCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azext_communication.generated._client_factory import cf_communication_cl
communication_custom = CliCommandType(
operations_tmpl='azext_communication.custom#{}',
client_factory=cf_communication_cl)
client_factory=None)
parent = super()
parent.__init__(cli_ctx=cli_ctx, custom_command_type=communication_custom,
command_group_cls=CommunicationCommandGroup)

def load_command_table(self, args):
from azext_communication.generated.commands import load_command_table
load_command_table(self, args)
from azext_communication.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
)
try:
from azext_communication.manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
load_command_table(self, args)
return self.command_table

def load_arguments(self, command):
from azext_communication.generated._params import load_arguments
load_arguments(self, command)
try:
from azext_communication.manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# 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.
# --------------------------------------------------------------------------
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# 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=protected-access
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
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(
"communication",
)
class __CMDGroup(AAZCommandGroup):
"""Manage communication service with communication.
"""
pass


__all__ = ["__CMDGroup"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# --------------------------------------------------------------------------------------------
# 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 ._check_name_availability import *
from ._create import *
from ._delete import *
from ._link_notification_hub import *
from ._list import *
from ._list_key import *
from ._list_verified_exchange_online_domain import *
from ._regenerate_key import *
from ._show import *
from ._update import *
from ._wait import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# --------------------------------------------------------------------------------------------
# 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(
"communication check-name-availability",
)
class CheckNameAvailability(AAZCommand):
"""Checks that the CommunicationService name is valid and is not already in use.
"""

_aaz_info = {
"version": "2023-04-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.communication/checknameavailability", "2023-04-01-preview"],
]
}

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()

_args_schema = None

@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
if cls._args_schema is not None:
return cls._args_schema
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)

# define Arg Group ""

# define Arg Group "NameAvailabilityParameters"

_args_schema = cls._args_schema
_args_schema.name = AAZStrArg(
options=["--name"],
arg_group="NameAvailabilityParameters",
help="The name of the resource for which availability needs to be checked.",
required=True,
)
_args_schema.type = AAZStrArg(
options=["--type"],
arg_group="NameAvailabilityParameters",
help="The resource type.",
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.CommunicationServicesCheckNameAvailability(ctx=self.ctx)()
self.post_operations()

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

def _output(self, *args, **kwargs):
result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True)
return result

class CommunicationServicesCheckNameAvailability(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
request = self.make_request()
session = self.client.send_request(request=request, stream=False, **kwargs)
if session.http_response.status_code in [200]:
return self.on_200(session)

return self.on_error(session.http_response)

@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability",
**self.url_parameters
)

@property
def method(self):
return "POST"

@property
def error_format(self):
return "MgmtErrorFormat"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-04-01-preview",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
**self.serialize_header_param(
"Content-Type", "application/json",
),
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

@property
def content(self):
_content_value, _builder = self.new_content_builder(
self.ctx.args,
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}})

return self.serialize_content(_content_value)

def on_200(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_200
)

_schema_on_200 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()

_schema_on_200 = cls._schema_on_200
_schema_on_200.message = AAZStrType()
_schema_on_200.name_available = AAZBoolType(
serialized_name="nameAvailable",
)
_schema_on_200.reason = AAZStrType()

return cls._schema_on_200


class _CheckNameAvailabilityHelper:
"""Helper class for CheckNameAvailability"""


__all__ = ["CheckNameAvailability"]
Loading