diff --git a/src/azure-cli/azure/cli/command_modules/vm/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/__init__.py index 69b0b8d664a..42d6e85ca60 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/vm/__init__.py @@ -65,79 +65,4 @@ def load_arguments(self, command): pass -class AzureStackComputeCommandsLoader(AzCommandsLoader): - - def __init__(self, cli_ctx=None): - from azure.cli.core.commands import CliCommandType - compute_custom = CliCommandType( - operations_tmpl='azure.cli.command_modules.vm.azure_stack.custom#{}', - operation_group='virtual_machines' - ) - super().__init__(cli_ctx=cli_ctx, - resource_type=ResourceType.MGMT_COMPUTE, - operation_group='virtual_machines', - custom_command_type=compute_custom) - - def load_command_table(self, args): - from azure.cli.command_modules.vm.azure_stack.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) - try: - # When generated commands are required uncomment the following two lines. - from .generated.commands import load_command_table as load_command_table_generated - load_command_table_generated(self, args) - from .manual.commands import load_command_table as load_command_table_manual - load_command_table_manual(self, args) - except ImportError: - pass - - profile = self.get_module_by_profile("commands") - if profile and hasattr(profile, 'load_command_table'): - profile.load_command_table(self, args) - - return self.command_table - - def load_arguments(self, command): - from azure.cli.command_modules.vm.azure_stack._params import load_arguments - load_arguments(self, command) - try: - from .generated._params import load_arguments as load_arguments_generated - load_arguments_generated(self, command) - from .manual._params import load_arguments as load_arguments_manual - load_arguments_manual(self, command) - except ImportError: - pass - - profile = self.get_module_by_profile("_params") - if profile and hasattr(profile, 'load_arguments'): - profile.load_arguments(self, command) - - def get_module_name_by_profile(self, module_name): - from azure.cli.core.aaz.utils import get_aaz_profile_module_name - profile_module_name = get_aaz_profile_module_name(profile_name=self.cli_ctx.cloud.profile) - if module_name: - return f'azure.cli.command_modules.vm.azure_stack.{profile_module_name}.{module_name}' - return f'azure.cli.command_modules.vm.azure_stack.{profile_module_name}' - - def get_module_by_profile(self, name): - import importlib - module_name = self.get_module_name_by_profile(name) - return importlib.import_module(module_name) - - -def get_command_loader(cli_ctx): - if cli_ctx.cloud.profile.lower() != "latest": - return AzureStackComputeCommandsLoader - - return ComputeCommandsLoader +COMMAND_LOADER_CLS = ComputeCommandsLoader diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/__init__.py deleted file mode 100644 index f6acc11aa4e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 - diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/__cmd_group.py deleted file mode 100644 index a10530cf097..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/__cmd_group.py deleted file mode 100644 index 58d1554a9a5..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity reservation. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/__cmd_group.py deleted file mode 100644 index 84dd1dd45a2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation group", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity reservation group. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/__init__.py deleted file mode 100644 index d63ae5a6fc9..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/_list.py deleted file mode 100644 index 0d8796f5f6e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/capacity/reservation/group/_list.py +++ /dev/null @@ -1,519 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation group list", -) -class List(AAZCommand): - """List the capacity reservation groups. - - :example: List capacity reservation groups - az capacity reservation group list -g rg - - :example: List the capacity reservation groups containing VM instances and VMSS instance which are associated to capacity reservation group - az capacity reservation group list -g rg --vm-instance --vmss-instance - """ - - _aaz_info = { - "version": "2024-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/capacityreservationgroups", "2024-03-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/capacityreservationgroups", "2024-03-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response.", - enum={"virtualMachineScaleSetVMs/$ref": "virtualMachineScaleSetVMs/$ref", "virtualMachines/$ref": "virtualMachines/$ref"}, - ) - _args_schema.resource_ids_only = AAZStrArg( - options=["--resource-ids-only"], - help="The query option to fetch capacity reservation group resource Ids. 'CreatedInSubscription' enables fetching resource Ids for all capacity reservation group resources created in the subscription. 'SharedWithSubscription' enables fetching resource Ids for all capacity reservation group resources shared with the subscription. 'All' enables fetching resource Ids for all capacity reservation group resources shared with the subscription and created in the subscription.", - enum={"All": "All", "CreatedInSubscription": "CreatedInSubscription", "SharedWithSubscription": "SharedWithSubscription"}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.CapacityReservationGroupsListBySubscription(ctx=self.ctx)() - if condition_1: - self.CapacityReservationGroupsListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class CapacityReservationGroupsListBySubscription(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.Compute/capacityReservationGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "resourceIdsOnly", self.ctx.args.resource_ids_only, - ), - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - flags={"read_only": True}, - ) - properties.sharing_profile = AAZObjectType( - serialized_name="sharingProfile", - ) - properties.virtual_machines_associated = AAZListType( - serialized_name="virtualMachinesAssociated", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.capacity_reservations - capacity_reservations.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(capacity_reservations.Element) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - instance_view.shared_subscription_ids = AAZListType( - serialized_name="sharedSubscriptionIds", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations - capacity_reservations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.statuses = AAZListType() - _element.utilization_info = AAZObjectType( - serialized_name="utilizationInfo", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - utilization_info = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info - utilization_info.current_capacity = AAZIntType( - serialized_name="currentCapacity", - flags={"read_only": True}, - ) - utilization_info.virtual_machines_allocated = AAZListType( - serialized_name="virtualMachinesAllocated", - flags={"read_only": True}, - ) - - virtual_machines_allocated = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info.virtual_machines_allocated - virtual_machines_allocated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_allocated.Element) - - shared_subscription_ids = cls._schema_on_200.value.Element.properties.instance_view.shared_subscription_ids - shared_subscription_ids.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(shared_subscription_ids.Element) - - sharing_profile = cls._schema_on_200.value.Element.properties.sharing_profile - sharing_profile.subscription_ids = AAZListType( - serialized_name="subscriptionIds", - ) - - subscription_ids = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids - subscription_ids.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids.Element - _element.id = AAZStrType() - - virtual_machines_associated = cls._schema_on_200.value.Element.properties.virtual_machines_associated - virtual_machines_associated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_associated.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class CapacityReservationGroupsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - flags={"read_only": True}, - ) - properties.sharing_profile = AAZObjectType( - serialized_name="sharingProfile", - ) - properties.virtual_machines_associated = AAZListType( - serialized_name="virtualMachinesAssociated", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.capacity_reservations - capacity_reservations.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(capacity_reservations.Element) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - instance_view.shared_subscription_ids = AAZListType( - serialized_name="sharedSubscriptionIds", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations - capacity_reservations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.statuses = AAZListType() - _element.utilization_info = AAZObjectType( - serialized_name="utilizationInfo", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - utilization_info = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info - utilization_info.current_capacity = AAZIntType( - serialized_name="currentCapacity", - flags={"read_only": True}, - ) - utilization_info.virtual_machines_allocated = AAZListType( - serialized_name="virtualMachinesAllocated", - flags={"read_only": True}, - ) - - virtual_machines_allocated = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info.virtual_machines_allocated - virtual_machines_allocated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_allocated.Element) - - shared_subscription_ids = cls._schema_on_200.value.Element.properties.instance_view.shared_subscription_ids - shared_subscription_ids.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(shared_subscription_ids.Element) - - sharing_profile = cls._schema_on_200.value.Element.properties.sharing_profile - sharing_profile.subscription_ids = AAZListType( - serialized_name="subscriptionIds", - ) - - subscription_ids = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids - subscription_ids.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids.Element - _element.id = AAZStrType() - - virtual_machines_associated = cls._schema_on_200.value.Element.properties.virtual_machines_associated - virtual_machines_associated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_associated.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_sub_resource_read_only_read = None - - @classmethod - def _build_schema_sub_resource_read_only_read(cls, _schema): - if cls._schema_sub_resource_read_only_read is not None: - _schema.id = cls._schema_sub_resource_read_only_read.id - return - - cls._schema_sub_resource_read_only_read = _schema_sub_resource_read_only_read = AAZObjectType() - - sub_resource_read_only_read = _schema_sub_resource_read_only_read - sub_resource_read_only_read.id = AAZStrType( - flags={"read_only": True}, - ) - - _schema.id = cls._schema_sub_resource_read_only_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/__cmd_group.py deleted file mode 100644 index ef273230237..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/__cmd_group.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk", -) -class __CMDGroup(AAZCommandGroup): - """Manage Azure Managed Disks. - - Azure Virtual Machines use disks as a place to store an operating system, applications, and data. All Azure virtual machines have at least two disks: An operating system disk, and a temporary disk. The operating system disk is created from an image, and both the operating system disk and the image are actually virtual hard disks (VHDs) stored in an Azure storage account. Virtual machines also can have one or more data disks, that are also stored as VHDs. - Azure Unmanaged Data Disks have a maximum size of 4095 GB. To use disks larger than 4095 GB use [Azure Managed Disks](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview) - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/__init__.py deleted file mode 100644 index 59700973595..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._grant_access import * -from ._list import * -from ._revoke_access import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_create.py deleted file mode 100644 index 5aca5a87313..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_create.py +++ /dev/null @@ -1,611 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk create", -) -class Create(AAZCommand): - """Create a managed disk. - - :example: Create a managed disk by importing from a blob uri. - az disk create -g MyResourceGroup -n MyDisk --source https://vhd1234.blob.core.windows.net/vhds/osdisk1234.vhd - - :example: Create an empty managed disk. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 - - :example: Create an empty managed disk with bursting enabled. - az disk create -g MyResourceGroup -n MyDisk --size-gb 1024 --location centraluseuap --enable-bursting - - :example: Create a managed disk by copying an existing disk or snapshot. - az disk create -g MyResourceGroup -n MyDisk2 --source MyDisk - - :example: Create a disk in an availability zone in the region of "East US 2". - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --location eastus2 --zone 1 - - :example: Create a disk from image. - az disk create -g MyResourceGroup -n MyDisk --image-reference Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest - - :example: Create a disk from the OS Disk of a compute gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.0.0 - - :example: Create a disk from the OS Disk of the latest version in a compute gallery image. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage - - :example: Create a disk from the OS Disk of a shared gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /SharedGalleries/sharedGalleryUniqueName/Images/imageName/Versions/1.0.0 - - :example: Create a disk from the OS Disk of a community gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /CommunityGalleries/communityGalleryPublicGalleryName/Images/imageName/Versions/1.0.0 - - :example: Create a disk from the Data Disk of a gallery image. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.0.0 --gallery-image-reference-lun 0 - - :example: Create a disk with total number of IOPS and total throughput (MBps) limitation. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --sku UltraSSD_LRS --disk-iops-read-only 200 --disk-mbps-read-only 30 - - :example: Create a disk and specify maximum number of VMs that can attach to the disk at the same time. - az disk create -g MyResourceGroup -n MyDisk --size-gb 256 --max-shares 2 -l centraluseuap - - :example: Create a disk and associate it with a disk access resource. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Create a disk from the blob URI for VM guest state VHD. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --security-data-uri GuestStateDiskVhdUri --security-type TrustedLaunch --hyper-v-generation V2 - - :example: Create a standard disk for uploading blobs. - az disk create -g MyResourceGroup -n MyDisk --upload-size-bytes 20972032 --upload-type Upload - - :example: Create an OS disk for uploading along with VM guest state. - az disk create -g MyResourceGroup -n MyDisk --upload-size-bytes 20972032 --upload-type UploadWithSecurityData --security-type TrustedLaunch --hyper-v-generation V2 - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Disk" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Disk", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - arg_group="Disk", - help="The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS.", - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Disk", - help="Resource tags", - ) - _args_schema.zones = AAZListArg( - options=["--zones"], - arg_group="Disk", - help="The Logical zone list for Disk.", - ) - - sku = cls._args_schema.sku - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - zones = cls._args_schema.zones - zones.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.creation_data = AAZObjectArg( - options=["--creation-data"], - arg_group="Properties", - help="Disk source information. CreationData information cannot be changed after the disk has been created.", - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["--disk-size-gb"], - arg_group="Properties", - help="If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.", - ) - _args_schema.encryption_settings = AAZObjectArg( - options=["--encryption-settings"], - arg_group="Properties", - help="Encryption settings for disk or snapshot", - ) - _args_schema.os_type = AAZStrArg( - options=["--os-type"], - arg_group="Properties", - help="The Operating System type.", - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - - creation_data = cls._args_schema.creation_data - creation_data.create_option = AAZStrArg( - options=["create-option"], - help="This enumerates the possible sources of a disk's creation.", - required=True, - enum={"Attach": "Attach", "Copy": "Copy", "Empty": "Empty", "FromImage": "FromImage", "Import": "Import"}, - ) - creation_data.image_reference = AAZObjectArg( - options=["image-reference"], - help="Disk source information for PIR or user images.", - ) - creation_data.source_resource_id = AAZStrArg( - options=["source-resource-id"], - help="If createOption is Copy, this is the ARM id of the source snapshot or disk.", - ) - creation_data.source_uri = AAZStrArg( - options=["source-uri"], - help="If createOption is Import, this is the URI of a blob to be imported into a managed disk.", - ) - creation_data.storage_account_id = AAZStrArg( - options=["storage-account-id"], - help="Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk.", - ) - - image_reference = cls._args_schema.creation_data.image_reference - image_reference.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository or user image reference.", - ) - image_reference.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - ) - - encryption_settings = cls._args_schema.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectArg( - options=["disk-encryption-key"], - help="Key Vault Secret Url and vault id of the disk encryption key", - ) - encryption_settings.enabled = AAZBoolArg( - options=["enabled"], - help="Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.", - ) - encryption_settings.key_encryption_key = AAZObjectArg( - options=["key-encryption-key"], - help="Key Vault Key Url and vault id of the key encryption key", - ) - - disk_encryption_key = cls._args_schema.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrArg( - options=["secret-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - disk_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(disk_encryption_key.source_vault) - - key_encryption_key = cls._args_schema.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrArg( - options=["key-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - key_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(key_encryption_key.source_vault) - return cls._args_schema - - _args_source_vault_create = None - - @classmethod - def _build_args_source_vault_create(cls, _schema): - if cls._args_source_vault_create is not None: - _schema.id = cls._args_source_vault_create.id - return - - cls._args_source_vault_create = AAZObjectArg() - - source_vault_create = cls._args_source_vault_create - source_vault_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_source_vault_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.DisksCreateOrUpdate(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 DisksCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - _builder.set_prop("tags", AAZDictType, ".tags") - _builder.set_prop("zones", AAZListType, ".zones") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("creationData", AAZObjectType, ".creation_data", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryptionSettings", AAZObjectType, ".encryption_settings") - properties.set_prop("osType", AAZStrType, ".os_type") - - creation_data = _builder.get(".properties.creationData") - if creation_data is not None: - creation_data.set_prop("createOption", AAZStrType, ".create_option", typ_kwargs={"flags": {"required": True}}) - creation_data.set_prop("imageReference", AAZObjectType, ".image_reference") - creation_data.set_prop("sourceResourceId", AAZStrType, ".source_resource_id") - creation_data.set_prop("sourceUri", AAZStrType, ".source_uri") - creation_data.set_prop("storageAccountId", AAZStrType, ".storage_account_id") - - image_reference = _builder.get(".properties.creationData.imageReference") - if image_reference is not None: - image_reference.set_prop("id", AAZStrType, ".id") - image_reference.set_prop("lun", AAZIntType, ".lun") - - encryption_settings = _builder.get(".properties.encryptionSettings") - if encryption_settings is not None: - encryption_settings.set_prop("diskEncryptionKey", AAZObjectType, ".disk_encryption_key") - encryption_settings.set_prop("enabled", AAZBoolType, ".enabled") - encryption_settings.set_prop("keyEncryptionKey", AAZObjectType, ".key_encryption_key") - - disk_encryption_key = _builder.get(".properties.encryptionSettings.diskEncryptionKey") - if disk_encryption_key is not None: - disk_encryption_key.set_prop("secretUrl", AAZStrType, ".secret_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(disk_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - key_encryption_key = _builder.get(".properties.encryptionSettings.keyEncryptionKey") - if key_encryption_key is not None: - key_encryption_key.set_prop("keyUrl", AAZStrType, ".key_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(key_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".name") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - zones = _builder.get(".zones") - if zones is not None: - zones.set_elements(AAZStrType, ".") - - 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() - _CreateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_source_vault_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_disk_read = None - - @classmethod - def _build_schema_disk_read(cls, _schema): - if cls._schema_disk_read is not None: - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - return - - cls._schema_disk_read = _schema_disk_read = AAZObjectType() - - disk_read = _schema_disk_read - disk_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_read.location = AAZStrType( - flags={"required": True}, - ) - disk_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - disk_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_read.sku = AAZObjectType() - disk_read.tags = AAZDictType() - disk_read.type = AAZStrType( - flags={"read_only": True}, - ) - disk_read.zones = AAZListType() - - properties = _schema_disk_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = _schema_disk_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = _schema_disk_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = _schema_disk_read.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_read.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_read.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_disk_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_disk_read.tags - tags.Element = AAZStrType() - - zones = _schema_disk_read.zones - zones.Element = AAZStrType() - - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_delete.py deleted file mode 100644 index 22166023d7d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_delete.py +++ /dev/null @@ -1,230 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete a managed disk. - - :example: Delete a managed disk. - az disk delete --name MyManagedDisk --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksDelete(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 DisksDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_grant_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_grant_access.py deleted file mode 100644 index 4159b597881..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_grant_access.py +++ /dev/null @@ -1,231 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk grant-access", -) -class GrantAccess(AAZCommand): - """Grant a resource access to a managed disk. - - :example: Grant a resource read access to a managed disk. - az disk grant-access --access-level Read --duration-in-seconds 3600 --name MyManagedDisk --resource-group MyResourceGroup - - :example: Grant a resource read access to a disk to generate access SAS and security data access SAS - az disk grant-access --access-level Read --duration-in-seconds 3600 --name MyDisk --resource-group MyResourceGroup --secure-vm-guest-state-sas - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}/begingetaccess", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "GrantAccessData" - - _args_schema = cls._args_schema - _args_schema.access_level = AAZStrArg( - options=["--access", "--access-level"], - arg_group="GrantAccessData", - help="Access level.", - required=True, - default="Read", - enum={"None": "None", "Read": "Read"}, - ) - _args_schema.duration_in_seconds = AAZIntArg( - options=["--duration-in-seconds"], - arg_group="GrantAccessData", - help="Time duration in seconds until the SAS access expires.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksGrantAccess(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 DisksGrantAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - **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( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - 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("access", AAZStrType, ".access_level", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("durationInSeconds", AAZIntType, ".duration_in_seconds", 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.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties - properties.output = AAZObjectType( - flags={"client_flatten": True}, - ) - - output = cls._schema_on_200.properties.output - output.access_sas = AAZStrType( - serialized_name="accessSAS", - flags={"read_only": True}, - ) - - return cls._schema_on_200 - - -class _GrantAccessHelper: - """Helper class for GrantAccess""" - - -__all__ = ["GrantAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_list.py deleted file mode 100644 index 354681b6c10..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_list.py +++ /dev/null @@ -1,494 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk list", -) -class List(AAZCommand): - """List managed disks. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/disks", "2017-03-30"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.DisksList(ctx=self.ctx)() - if condition_1: - self.DisksListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class DisksList(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.Compute/disks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class DisksListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_revoke_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_revoke_access.py deleted file mode 100644 index e75d92c951a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_revoke_access.py +++ /dev/null @@ -1,218 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk revoke-access", -) -class RevokeAccess(AAZCommand): - """Revoke a resource's read access to a managed disk. - - :example: Revoke a resource's read access to a managed disk. - az disk revoke-access --ids $id - - :example: Revoke a resource's read access to a managed disk. - az disk revoke-access --name MyManagedDisk --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}/endgetaccess", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksRevokeAccess(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 DisksRevokeAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - **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( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _RevokeAccessHelper: - """Helper class for RevokeAccess""" - - -__all__ = ["RevokeAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_show.py deleted file mode 100644 index 3d7bf84f58c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_show.py +++ /dev/null @@ -1,286 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk show", -) -class Show(AAZCommand): - """Get information about a disk. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(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 DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.zones = AAZListType() - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_update.py deleted file mode 100644 index c35600bbb12..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_update.py +++ /dev/null @@ -1,906 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk update", -) -class Update(AAZCommand): - """Update a managed disk. - - :example: Update a managed disk and associate it with a disk access resource. - az disk update --name MyManagedDisk --resource-group MyResourceGroup --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Update a managed disk. - az disk update --name MyManagedDisk --resource-group MyResourceGroup --size-gb 20 - """ - - _aaz_info = { - "version": "2023-04-02", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2023-04-02"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.sku = AAZStrArg( - options=["--sku"], - help="Underlying storage SKU.", - nullable=True, - enum={"PremiumV2_LRS": "PremiumV2_LRS", "Premium_LRS": "Premium_LRS", "Premium_ZRS": "Premium_ZRS", "StandardSSD_LRS": "StandardSSD_LRS", "StandardSSD_ZRS": "StandardSSD_ZRS", "Standard_LRS": "Standard_LRS", "UltraSSD_LRS": "UltraSSD_LRS"}, - ) - - # define Arg Group "Disk" - - # define Arg Group "Encryption" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_id = AAZStrArg( - options=["--disk-encryption-set-id"], - arg_group="Encryption", - help="ResourceId of the disk encryption set to use for enabling encryption at rest.", - nullable=True, - ) - _args_schema.encryption_type = AAZStrArg( - options=["--encryption-type"], - arg_group="Encryption", - help={"short-summary": "Encryption type.", "long-summary": "EncryptionAtRestWithPlatformKey: Disk is encrypted with XStore managed key at rest. It is the default encryption type. EncryptionAtRestWithCustomerKey: Disk is encrypted with Customer managed key at rest."}, - nullable=True, - enum={"EncryptionAtRestWithCustomerKey": "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys": "EncryptionAtRestWithPlatformAndCustomerKeys", "EncryptionAtRestWithPlatformKey": "EncryptionAtRestWithPlatformKey"}, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.bursting_enabled = AAZBoolArg( - options=["--enable-bursting", "--bursting-enabled"], - arg_group="Properties", - help="Enable on-demand bursting beyond the provisioned performance target of the disk. On-demand bursting is disabled by default, and it does not apply to Ultra disks.", - nullable=True, - ) - _args_schema.data_access_auth_mode = AAZStrArg( - options=["--data-access-auth-mode"], - arg_group="Properties", - help="Specify the auth mode when exporting or uploading to a disk or snapshot.", - nullable=True, - enum={"AzureActiveDirectory": "AzureActiveDirectory", "None": "None"}, - ) - _args_schema.disk_access_id = AAZStrArg( - options=["--disk-access-id"], - arg_group="Properties", - help="ARM id of the DiskAccess resource for using private endpoints on disks.", - nullable=True, - ) - _args_schema.disk_iops_read_only = AAZIntArg( - options=["--disk-iops-read-only"], - arg_group="Properties", - help="The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes.", - nullable=True, - ) - _args_schema.disk_iops_read_write = AAZIntArg( - options=["--disk-iops-read-write"], - arg_group="Properties", - help="The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.", - nullable=True, - ) - _args_schema.disk_mbps_read_only = AAZIntArg( - options=["--disk-mbps-read-only"], - arg_group="Properties", - help="The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.", - nullable=True, - ) - _args_schema.disk_mbps_read_write = AAZIntArg( - options=["--disk-mbps-read-write"], - arg_group="Properties", - help="The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.", - nullable=True, - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["-z", "--size-gb", "--disk-size-gb"], - arg_group="Properties", - help="Size in GB. Max size: 4095 GB (certain preview disks can be larger).", - nullable=True, - ) - _args_schema.max_shares = AAZIntArg( - options=["--max-shares"], - arg_group="Properties", - help="The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time.", - nullable=True, - ) - _args_schema.network_access_policy = AAZStrArg( - options=["--network-access-policy"], - arg_group="Properties", - help="Policy for accessing the disk via network.", - nullable=True, - enum={"AllowAll": "AllowAll", "AllowPrivate": "AllowPrivate", "DenyAll": "DenyAll"}, - ) - _args_schema.public_network_access = AAZStrArg( - options=["--public-network-access"], - arg_group="Properties", - help="Customers can set on Managed Disks or Snapshots to control the export policy on the disk.", - is_preview=True, - nullable=True, - enum={"Disabled": "Disabled", "Enabled": "Enabled"}, - ) - - # define Arg Group "SupportedCapabilities" - - _args_schema = cls._args_schema - _args_schema.accelerated_network = AAZBoolArg( - options=["--accelerated-network"], - arg_group="SupportedCapabilities", - help="Customers can set on Managed Disks or Snapshots to enable the accelerated networking if the OS disk image support.", - is_preview=True, - nullable=True, - ) - _args_schema.architecture = AAZStrArg( - options=["--architecture"], - arg_group="SupportedCapabilities", - help="CPU architecture supported by an OS disk.", - nullable=True, - enum={"Arm64": "Arm64", "x64": "x64"}, - ) - return cls._args_schema - - _args_image_disk_reference_update = None - - @classmethod - def _build_args_image_disk_reference_update(cls, _schema): - if cls._args_image_disk_reference_update is not None: - _schema.community_gallery_image_id = cls._args_image_disk_reference_update.community_gallery_image_id - _schema.id = cls._args_image_disk_reference_update.id - _schema.lun = cls._args_image_disk_reference_update.lun - _schema.shared_gallery_image_id = cls._args_image_disk_reference_update.shared_gallery_image_id - return - - cls._args_image_disk_reference_update = AAZObjectArg( - nullable=True, - ) - - image_disk_reference_update = cls._args_image_disk_reference_update - image_disk_reference_update.community_gallery_image_id = AAZStrArg( - options=["community-gallery-image-id"], - help="A relative uri containing a community Azure Compute Gallery image reference.", - nullable=True, - ) - image_disk_reference_update.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference.", - nullable=True, - ) - image_disk_reference_update.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - nullable=True, - ) - image_disk_reference_update.shared_gallery_image_id = AAZStrArg( - options=["shared-gallery-image-id"], - help="A relative uri containing a direct shared Azure Compute Gallery image reference.", - nullable=True, - ) - - _schema.community_gallery_image_id = cls._args_image_disk_reference_update.community_gallery_image_id - _schema.id = cls._args_image_disk_reference_update.id - _schema.lun = cls._args_image_disk_reference_update.lun - _schema.shared_gallery_image_id = cls._args_image_disk_reference_update.shared_gallery_image_id - - _args_source_vault_update = None - - @classmethod - def _build_args_source_vault_update(cls, _schema): - if cls._args_source_vault_update is not None: - _schema.id = cls._args_source_vault_update.id - return - - cls._args_source_vault_update = AAZObjectArg() - - source_vault_update = cls._args_source_vault_update - source_vault_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_source_vault_update.id - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.DisksCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - class DisksCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("burstingEnabled", AAZBoolType, ".bursting_enabled") - properties.set_prop("dataAccessAuthMode", AAZStrType, ".data_access_auth_mode") - properties.set_prop("diskAccessId", AAZStrType, ".disk_access_id") - properties.set_prop("diskIOPSReadOnly", AAZIntType, ".disk_iops_read_only") - properties.set_prop("diskIOPSReadWrite", AAZIntType, ".disk_iops_read_write") - properties.set_prop("diskMBpsReadOnly", AAZIntType, ".disk_mbps_read_only") - properties.set_prop("diskMBpsReadWrite", AAZIntType, ".disk_mbps_read_write") - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryption", AAZObjectType) - properties.set_prop("maxShares", AAZIntType, ".max_shares") - properties.set_prop("networkAccessPolicy", AAZStrType, ".network_access_policy") - properties.set_prop("publicNetworkAccess", AAZStrType, ".public_network_access") - properties.set_prop("supportedCapabilities", AAZObjectType) - - encryption = _builder.get(".properties.encryption") - if encryption is not None: - encryption.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - encryption.set_prop("type", AAZStrType, ".encryption_type") - - supported_capabilities = _builder.get(".properties.supportedCapabilities") - if supported_capabilities is not None: - supported_capabilities.set_prop("acceleratedNetwork", AAZBoolType, ".accelerated_network") - supported_capabilities.set_prop("architecture", AAZStrType, ".architecture") - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".sku") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_image_disk_reference_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("communityGalleryImageId", AAZStrType, ".community_gallery_image_id") - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("lun", AAZIntType, ".lun") - _builder.set_prop("sharedGalleryImageId", AAZStrType, ".shared_gallery_image_id") - - @classmethod - def _build_schema_source_vault_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_disk_read = None - - @classmethod - def _build_schema_disk_read(cls, _schema): - if cls._schema_disk_read is not None: - _schema.extended_location = cls._schema_disk_read.extended_location - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.managed_by_extended = cls._schema_disk_read.managed_by_extended - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - return - - cls._schema_disk_read = _schema_disk_read = AAZObjectType() - - disk_read = _schema_disk_read - disk_read.extended_location = AAZObjectType( - serialized_name="extendedLocation", - ) - disk_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_read.location = AAZStrType( - flags={"required": True}, - ) - disk_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - disk_read.managed_by_extended = AAZListType( - serialized_name="managedByExtended", - flags={"read_only": True}, - ) - disk_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_read.sku = AAZObjectType() - disk_read.tags = AAZDictType() - disk_read.type = AAZStrType( - flags={"read_only": True}, - ) - disk_read.zones = AAZListType() - - extended_location = _schema_disk_read.extended_location - extended_location.name = AAZStrType() - extended_location.type = AAZStrType() - - managed_by_extended = _schema_disk_read.managed_by_extended - managed_by_extended.Element = AAZStrType() - - properties = _schema_disk_read.properties - properties.last_ownership_update_time = AAZStrType( - serialized_name="LastOwnershipUpdateTime", - flags={"read_only": True}, - ) - properties.bursting_enabled = AAZBoolType( - serialized_name="burstingEnabled", - ) - properties.bursting_enabled_time = AAZStrType( - serialized_name="burstingEnabledTime", - flags={"read_only": True}, - ) - properties.completion_percent = AAZFloatType( - serialized_name="completionPercent", - ) - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.data_access_auth_mode = AAZStrType( - serialized_name="dataAccessAuthMode", - ) - properties.disk_access_id = AAZStrType( - serialized_name="diskAccessId", - ) - properties.disk_iops_read_only = AAZIntType( - serialized_name="diskIOPSReadOnly", - ) - properties.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - properties.disk_m_bps_read_only = AAZIntType( - serialized_name="diskMBpsReadOnly", - ) - properties.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.disk_state = AAZStrType( - serialized_name="diskState", - flags={"read_only": True}, - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.max_shares = AAZIntType( - serialized_name="maxShares", - ) - properties.network_access_policy = AAZStrType( - serialized_name="networkAccessPolicy", - ) - properties.optimized_for_frequent_attach = AAZBoolType( - serialized_name="optimizedForFrequentAttach", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.property_updates_in_progress = AAZObjectType( - serialized_name="propertyUpdatesInProgress", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_network_access = AAZStrType( - serialized_name="publicNetworkAccess", - ) - properties.purchase_plan = AAZObjectType( - serialized_name="purchasePlan", - ) - properties.security_profile = AAZObjectType( - serialized_name="securityProfile", - ) - properties.share_info = AAZListType( - serialized_name="shareInfo", - flags={"read_only": True}, - ) - properties.supported_capabilities = AAZObjectType( - serialized_name="supportedCapabilities", - ) - properties.supports_hibernation = AAZBoolType( - serialized_name="supportsHibernation", - ) - properties.tier = AAZStrType() - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = _schema_disk_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.elastic_san_resource_id = AAZStrType( - serialized_name="elasticSanResourceId", - ) - creation_data.gallery_image_reference = AAZObjectType( - serialized_name="galleryImageReference", - ) - cls._build_schema_image_disk_reference_read(creation_data.gallery_image_reference) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - cls._build_schema_image_disk_reference_read(creation_data.image_reference) - creation_data.logical_sector_size = AAZIntType( - serialized_name="logicalSectorSize", - ) - creation_data.performance_plus = AAZBoolType( - serialized_name="performancePlus", - ) - creation_data.security_data_uri = AAZStrType( - serialized_name="securityDataUri", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - encryption = _schema_disk_read.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = _schema_disk_read.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = _schema_disk_read.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - property_updates_in_progress = _schema_disk_read.properties.property_updates_in_progress - property_updates_in_progress.target_tier = AAZStrType( - serialized_name="targetTier", - ) - - purchase_plan = _schema_disk_read.properties.purchase_plan - purchase_plan.name = AAZStrType( - flags={"required": True}, - ) - purchase_plan.product = AAZStrType( - flags={"required": True}, - ) - purchase_plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - purchase_plan.publisher = AAZStrType( - flags={"required": True}, - ) - - security_profile = _schema_disk_read.properties.security_profile - security_profile.secure_vm_disk_encryption_set_id = AAZStrType( - serialized_name="secureVMDiskEncryptionSetId", - ) - security_profile.security_type = AAZStrType( - serialized_name="securityType", - ) - - share_info = _schema_disk_read.properties.share_info - share_info.Element = AAZObjectType() - - _element = _schema_disk_read.properties.share_info.Element - _element.vm_uri = AAZStrType( - serialized_name="vmUri", - flags={"read_only": True}, - ) - - supported_capabilities = _schema_disk_read.properties.supported_capabilities - supported_capabilities.accelerated_network = AAZBoolType( - serialized_name="acceleratedNetwork", - ) - supported_capabilities.architecture = AAZStrType() - supported_capabilities.disk_controller_types = AAZStrType( - serialized_name="diskControllerTypes", - ) - - sku = _schema_disk_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_disk_read.tags - tags.Element = AAZStrType() - - zones = _schema_disk_read.zones - zones.Element = AAZStrType() - - _schema.extended_location = cls._schema_disk_read.extended_location - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.managed_by_extended = cls._schema_disk_read.managed_by_extended - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - - _schema_image_disk_reference_read = None - - @classmethod - def _build_schema_image_disk_reference_read(cls, _schema): - if cls._schema_image_disk_reference_read is not None: - _schema.community_gallery_image_id = cls._schema_image_disk_reference_read.community_gallery_image_id - _schema.id = cls._schema_image_disk_reference_read.id - _schema.lun = cls._schema_image_disk_reference_read.lun - _schema.shared_gallery_image_id = cls._schema_image_disk_reference_read.shared_gallery_image_id - return - - cls._schema_image_disk_reference_read = _schema_image_disk_reference_read = AAZObjectType() - - image_disk_reference_read = _schema_image_disk_reference_read - image_disk_reference_read.community_gallery_image_id = AAZStrType( - serialized_name="communityGalleryImageId", - ) - image_disk_reference_read.id = AAZStrType() - image_disk_reference_read.lun = AAZIntType() - image_disk_reference_read.shared_gallery_image_id = AAZStrType( - serialized_name="sharedGalleryImageId", - ) - - _schema.community_gallery_image_id = cls._schema_image_disk_reference_read.community_gallery_image_id - _schema.id = cls._schema_image_disk_reference_read.id - _schema.lun = cls._schema_image_disk_reference_read.lun - _schema.shared_gallery_image_id = cls._schema_image_disk_reference_read.shared_gallery_image_id - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_wait.py deleted file mode 100644 index 5cd5f7fb85f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/disk/_wait.py +++ /dev/null @@ -1,285 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(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=False) - return result - - class DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.zones = AAZListType() - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/__cmd_group.py deleted file mode 100644 index 3e4a7f17f85..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image", -) -class __CMDGroup(AAZCommandGroup): - """Manage custom virtual machine images. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_create.py deleted file mode 100644 index c7cf267daee..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_create.py +++ /dev/null @@ -1,528 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image create", -) -class Create(AAZCommand): - """Create a custom Virtual Machine Image from managed disks or snapshots. - - :example: Create an image from an existing disk. - az image create -g MyResourceGroup -n image1 --os-type Linux --source /subscriptions/db5eb68e-73e2-4fa8-b18a-0123456789999/resourceGroups/rg1/providers/Microsoft.Compute/snapshots/s1 - - :example: Create an image by capturing an existing generalized virtual machine in the same resource group. - az image create -g MyResourceGroup -n image1 --source MyVm1 - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.source_virtual_machine = AAZObjectArg( - options=["--source-virtual-machine"], - arg_group="Properties", - help="The source virtual machine from which Image is created.", - ) - _args_schema.storage_profile = AAZObjectArg( - options=["--storage-profile"], - arg_group="Properties", - help="Specifies the storage settings for the virtual machine disks.", - ) - - source_virtual_machine = cls._args_schema.source_virtual_machine - source_virtual_machine.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - storage_profile = cls._args_schema.storage_profile - storage_profile.data_disks = AAZListArg( - options=["data-disks"], - help="Specifies the parameters that are used to add a data disk to a virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview).", - ) - storage_profile.os_disk = AAZObjectArg( - options=["os-disk"], - help="Specifies information about the operating system disk used by the virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview).", - ) - - data_disks = cls._args_schema.storage_profile.data_disks - data_disks.Element = AAZObjectArg() - - _element = cls._args_schema.storage_profile.data_disks.Element - _element.blob_uri = AAZStrArg( - options=["blob-uri"], - help="The Virtual Hard Disk.", - ) - _element.caching = AAZStrArg( - options=["caching"], - help="Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**", - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - _element.disk_size_gb = AAZIntArg( - options=["disk-size-gb"], - help="Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB", - ) - _element.lun = AAZIntArg( - options=["lun"], - help="Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.", - required=True, - ) - _element.managed_disk = AAZObjectArg( - options=["managed-disk"], - help="The managedDisk.", - ) - _element.snapshot = AAZObjectArg( - options=["snapshot"], - help="The snapshot.", - ) - _element.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - managed_disk = cls._args_schema.storage_profile.data_disks.Element.managed_disk - managed_disk.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - snapshot = cls._args_schema.storage_profile.data_disks.Element.snapshot - snapshot.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - os_disk = cls._args_schema.storage_profile.os_disk - os_disk.blob_uri = AAZStrArg( - options=["blob-uri"], - help="The Virtual Hard Disk.", - ) - os_disk.caching = AAZStrArg( - options=["caching"], - help="Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**", - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - os_disk.disk_size_gb = AAZIntArg( - options=["disk-size-gb"], - help="Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB", - ) - os_disk.managed_disk = AAZObjectArg( - options=["managed-disk"], - help="The managedDisk.", - ) - cls._build_args_sub_resource_create(os_disk.managed_disk) - os_disk.os_state = AAZStrArg( - options=["os-state"], - help="The OS State. For managed images, use Generalized.", - required=True, - enum={"Generalized": "Generalized", "Specialized": "Specialized"}, - ) - os_disk.os_type = AAZStrArg( - options=["os-type"], - help="This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image.

Possible values are:

**Windows**

**Linux**", - required=True, - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - os_disk.snapshot = AAZObjectArg( - options=["snapshot"], - help="The snapshot.", - ) - os_disk.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - snapshot = cls._args_schema.storage_profile.os_disk.snapshot - snapshot.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - return cls._args_schema - - _args_sub_resource_create = None - - @classmethod - def _build_args_sub_resource_create(cls, _schema): - if cls._args_sub_resource_create is not None: - _schema.id = cls._args_sub_resource_create.id - return - - cls._args_sub_resource_create = AAZObjectArg() - - sub_resource_create = cls._args_sub_resource_create - sub_resource_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_sub_resource_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.ImagesCreateOrUpdate(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 ImagesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("sourceVirtualMachine", AAZObjectType, ".source_virtual_machine") - properties.set_prop("storageProfile", AAZObjectType, ".storage_profile") - - source_virtual_machine = _builder.get(".properties.sourceVirtualMachine") - if source_virtual_machine is not None: - source_virtual_machine.set_prop("id", AAZStrType, ".id") - - storage_profile = _builder.get(".properties.storageProfile") - if storage_profile is not None: - storage_profile.set_prop("dataDisks", AAZListType, ".data_disks") - storage_profile.set_prop("osDisk", AAZObjectType, ".os_disk") - - data_disks = _builder.get(".properties.storageProfile.dataDisks") - if data_disks is not None: - data_disks.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.storageProfile.dataDisks[]") - if _elements is not None: - _elements.set_prop("blobUri", AAZStrType, ".blob_uri") - _elements.set_prop("caching", AAZStrType, ".caching") - _elements.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - _elements.set_prop("lun", AAZIntType, ".lun", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("managedDisk", AAZObjectType, ".managed_disk") - _elements.set_prop("snapshot", AAZObjectType, ".snapshot") - _elements.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - - managed_disk = _builder.get(".properties.storageProfile.dataDisks[].managedDisk") - if managed_disk is not None: - managed_disk.set_prop("id", AAZStrType, ".id") - - snapshot = _builder.get(".properties.storageProfile.dataDisks[].snapshot") - if snapshot is not None: - snapshot.set_prop("id", AAZStrType, ".id") - - os_disk = _builder.get(".properties.storageProfile.osDisk") - if os_disk is not None: - os_disk.set_prop("blobUri", AAZStrType, ".blob_uri") - os_disk.set_prop("caching", AAZStrType, ".caching") - os_disk.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - _CreateHelper._build_schema_sub_resource_create(os_disk.set_prop("managedDisk", AAZObjectType, ".managed_disk")) - os_disk.set_prop("osState", AAZStrType, ".os_state", typ_kwargs={"flags": {"required": True}}) - os_disk.set_prop("osType", AAZStrType, ".os_type", typ_kwargs={"flags": {"required": True}}) - os_disk.set_prop("snapshot", AAZObjectType, ".snapshot") - os_disk.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - - snapshot = _builder.get(".properties.storageProfile.osDisk.snapshot") - if snapshot is not None: - snapshot.set_prop("id", AAZStrType, ".id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200_201.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _CreateHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200_201.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200_201.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _CreateHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _CreateHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200_201.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _CreateHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _CreateHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_sub_resource_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_delete.py deleted file mode 100644 index b322a135fff..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_delete.py +++ /dev/null @@ -1,226 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image delete", -) -class Delete(AAZCommand): - """Delete an Image. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.ImagesDelete(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 ImagesDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_list.py deleted file mode 100644 index b7c4f0d9e85..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_list.py +++ /dev/null @@ -1,452 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image list", -) -class List(AAZCommand): - """List the list of images under a resource group. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/images", "2017-03-30"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.ImagesList(ctx=self.ctx)() - if condition_1: - self.ImagesListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class ImagesList(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.Compute/images", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ListHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - flags={"required": True}, - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class ImagesListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ListHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - flags={"required": True}, - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_show.py deleted file mode 100644 index 009f6297454..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_show.py +++ /dev/null @@ -1,273 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image show", -) -class Show(AAZCommand): - """Get an image. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(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 ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ShowHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ShowHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ShowHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_update.py deleted file mode 100644 index 09d9b335eaf..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_update.py +++ /dev/null @@ -1,494 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image update", -) -class Update(AAZCommand): - """Update custom VM images. - - :example: Add or update tags. - az image update -n ImageName -g ResourceGroup --tags tag1=val1 tag2=val2 - - :example: Remove all tags. - az image update -n ImageName -g resourceGroup --tags - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "Properties" - return cls._args_schema - - _args_sub_resource_update = None - - @classmethod - def _build_args_sub_resource_update(cls, _schema): - if cls._args_sub_resource_update is not None: - _schema.id = cls._args_sub_resource_update.id - return - - cls._args_sub_resource_update = AAZObjectArg( - nullable=True, - ) - - sub_resource_update = cls._args_sub_resource_update - sub_resource_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_sub_resource_update.id - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.ImagesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_image_read(cls._schema_on_200) - - return cls._schema_on_200 - - class ImagesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_image_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_sub_resource_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_image_read = None - - @classmethod - def _build_schema_image_read(cls, _schema): - if cls._schema_image_read is not None: - _schema.id = cls._schema_image_read.id - _schema.location = cls._schema_image_read.location - _schema.name = cls._schema_image_read.name - _schema.properties = cls._schema_image_read.properties - _schema.tags = cls._schema_image_read.tags - _schema.type = cls._schema_image_read.type - return - - cls._schema_image_read = _schema_image_read = AAZObjectType() - - image_read = _schema_image_read - image_read.id = AAZStrType( - flags={"read_only": True}, - ) - image_read.location = AAZStrType( - flags={"required": True}, - ) - image_read.name = AAZStrType( - flags={"read_only": True}, - ) - image_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - image_read.tags = AAZDictType() - image_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_image_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - cls._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = _schema_image_read.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = _schema_image_read.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = _schema_image_read.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - cls._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - cls._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = _schema_image_read.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - cls._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - cls._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = _schema_image_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_image_read.id - _schema.location = cls._schema_image_read.location - _schema.name = cls._schema_image_read.name - _schema.properties = cls._schema_image_read.properties - _schema.tags = cls._schema_image_read.tags - _schema.type = cls._schema_image_read.type - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_wait.py deleted file mode 100644 index 3be45d8d9e0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/image/_wait.py +++ /dev/null @@ -1,272 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(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=False) - return result - - class ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _WaitHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _WaitHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _WaitHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _WaitHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _WaitHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/__cmd_group.py deleted file mode 100644 index 7582bb60b24..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/__cmd_group.py +++ /dev/null @@ -1,20 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage Azure Network resources. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/__cmd_group.py deleted file mode 100644 index 4eb94459c8c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage application-level routing and load balancing services. - - To learn more about Application Gateway, visit https://learn.microsoft.com/en-us/azure/application-gateway/quick-create-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/__init__.py deleted file mode 100644 index 28d5f355813..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/_show.py deleted file mode 100644 index bcb67742ead..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/application_gateway/_show.py +++ /dev/null @@ -1,1489 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of an application gateway. - - :example: Get the details of an application gateway. - az network application-gateway show -g MyResourceGroup -n MyAppGateway - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the application gateway.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ApplicationGatewaysGet(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 ApplicationGatewaysGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "applicationGatewayName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType() - _schema_on_200.id = AAZStrType() - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.authentication_certificates = AAZListType( - serialized_name="authenticationCertificates", - ) - properties.backend_address_pools = AAZListType( - serialized_name="backendAddressPools", - ) - properties.backend_http_settings_collection = AAZListType( - serialized_name="backendHttpSettingsCollection", - ) - properties.enable_http2 = AAZBoolType( - serialized_name="enableHttp2", - ) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - ) - properties.frontend_ports = AAZListType( - serialized_name="frontendPorts", - ) - properties.gateway_ip_configurations = AAZListType( - serialized_name="gatewayIPConfigurations", - ) - properties.http_listeners = AAZListType( - serialized_name="httpListeners", - ) - properties.operational_state = AAZStrType( - serialized_name="operationalState", - flags={"read_only": True}, - ) - properties.probes = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configurations = AAZListType( - serialized_name="redirectConfigurations", - ) - properties.request_routing_rules = AAZListType( - serialized_name="requestRoutingRules", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.sku = AAZObjectType() - properties.ssl_certificates = AAZListType( - serialized_name="sslCertificates", - ) - properties.ssl_policy = AAZObjectType( - serialized_name="sslPolicy", - ) - properties.url_path_maps = AAZListType( - serialized_name="urlPathMaps", - ) - properties.web_application_firewall_configuration = AAZObjectType( - serialized_name="webApplicationFirewallConfiguration", - ) - - authentication_certificates = cls._schema_on_200.properties.authentication_certificates - authentication_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.authentication_certificates.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.authentication_certificates.Element.properties - properties.data = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_address_pools = cls._schema_on_200.properties.backend_address_pools - backend_address_pools.Element = AAZObjectType() - _ShowHelper._build_schema_application_gateway_backend_address_pool_read(backend_address_pools.Element) - - backend_http_settings_collection = cls._schema_on_200.properties.backend_http_settings_collection - backend_http_settings_collection.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.backend_http_settings_collection.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties - properties.affinity_cookie_name = AAZStrType( - serialized_name="affinityCookieName", - ) - properties.authentication_certificates = AAZListType( - serialized_name="authenticationCertificates", - ) - properties.connection_draining = AAZObjectType( - serialized_name="connectionDraining", - ) - properties.cookie_based_affinity = AAZStrType( - serialized_name="cookieBasedAffinity", - ) - properties.host_name = AAZStrType( - serialized_name="hostName", - ) - properties.path = AAZStrType() - properties.pick_host_name_from_backend_address = AAZBoolType( - serialized_name="pickHostNameFromBackendAddress", - ) - properties.port = AAZIntType() - properties.probe = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.probe) - properties.probe_enabled = AAZBoolType( - serialized_name="probeEnabled", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.request_timeout = AAZIntType( - serialized_name="requestTimeout", - ) - - authentication_certificates = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties.authentication_certificates - authentication_certificates.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(authentication_certificates.Element) - - connection_draining = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties.connection_draining - connection_draining.drain_timeout_in_sec = AAZIntType( - serialized_name="drainTimeoutInSec", - flags={"required": True}, - ) - connection_draining.enabled = AAZBoolType( - flags={"required": True}, - ) - - frontend_ip_configurations = cls._schema_on_200.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.frontend_ip_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - _ShowHelper._build_schema_sub_resource_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.subnet) - - frontend_ports = cls._schema_on_200.properties.frontend_ports - frontend_ports.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.frontend_ports.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.frontend_ports.Element.properties - properties.port = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - gateway_ip_configurations = cls._schema_on_200.properties.gateway_ip_configurations - gateway_ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.gateway_ip_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.gateway_ip_configurations.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.subnet = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.subnet) - - http_listeners = cls._schema_on_200.properties.http_listeners - http_listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.http_listeners.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.http_listeners.Element.properties - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZObjectType( - serialized_name="frontendPort", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_port) - properties.host_name = AAZStrType( - serialized_name="hostName", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.require_server_name_indication = AAZBoolType( - serialized_name="requireServerNameIndication", - ) - properties.ssl_certificate = AAZObjectType( - serialized_name="sslCertificate", - ) - _ShowHelper._build_schema_sub_resource_read(properties.ssl_certificate) - - probes = cls._schema_on_200.properties.probes - probes.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.probes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.probes.Element.properties - properties.host = AAZStrType() - properties.interval = AAZIntType() - properties.match = AAZObjectType() - properties.min_servers = AAZIntType( - serialized_name="minServers", - ) - properties.path = AAZStrType() - properties.pick_host_name_from_backend_http_settings = AAZBoolType( - serialized_name="pickHostNameFromBackendHttpSettings", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.timeout = AAZIntType() - properties.unhealthy_threshold = AAZIntType( - serialized_name="unhealthyThreshold", - ) - - match = cls._schema_on_200.properties.probes.Element.properties.match - match.body = AAZStrType() - match.status_codes = AAZListType( - serialized_name="statusCodes", - ) - - status_codes = cls._schema_on_200.properties.probes.Element.properties.match.status_codes - status_codes.Element = AAZStrType() - - redirect_configurations = cls._schema_on_200.properties.redirect_configurations - redirect_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.redirect_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.redirect_configurations.Element.properties - properties.include_path = AAZBoolType( - serialized_name="includePath", - ) - properties.include_query_string = AAZBoolType( - serialized_name="includeQueryString", - ) - properties.path_rules = AAZListType( - serialized_name="pathRules", - ) - properties.redirect_type = AAZStrType( - serialized_name="redirectType", - ) - properties.request_routing_rules = AAZListType( - serialized_name="requestRoutingRules", - ) - properties.target_listener = AAZObjectType( - serialized_name="targetListener", - ) - _ShowHelper._build_schema_sub_resource_read(properties.target_listener) - properties.target_url = AAZStrType( - serialized_name="targetUrl", - ) - properties.url_path_maps = AAZListType( - serialized_name="urlPathMaps", - ) - - path_rules = cls._schema_on_200.properties.redirect_configurations.Element.properties.path_rules - path_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(path_rules.Element) - - request_routing_rules = cls._schema_on_200.properties.redirect_configurations.Element.properties.request_routing_rules - request_routing_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(request_routing_rules.Element) - - url_path_maps = cls._schema_on_200.properties.redirect_configurations.Element.properties.url_path_maps - url_path_maps.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(url_path_maps.Element) - - request_routing_rules = cls._schema_on_200.properties.request_routing_rules - request_routing_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.request_routing_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.request_routing_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_http_settings = AAZObjectType( - serialized_name="backendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_http_settings) - properties.http_listener = AAZObjectType( - serialized_name="httpListener", - ) - _ShowHelper._build_schema_sub_resource_read(properties.http_listener) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configuration = AAZObjectType( - serialized_name="redirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.redirect_configuration) - properties.rule_type = AAZStrType( - serialized_name="ruleType", - ) - properties.url_path_map = AAZObjectType( - serialized_name="urlPathMap", - ) - _ShowHelper._build_schema_sub_resource_read(properties.url_path_map) - - sku = cls._schema_on_200.properties.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - ssl_certificates = cls._schema_on_200.properties.ssl_certificates - ssl_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.ssl_certificates.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.ssl_certificates.Element.properties - properties.data = AAZStrType() - properties.password = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_cert_data = AAZStrType( - serialized_name="publicCertData", - ) - - ssl_policy = cls._schema_on_200.properties.ssl_policy - ssl_policy.cipher_suites = AAZListType( - serialized_name="cipherSuites", - ) - ssl_policy.disabled_ssl_protocols = AAZListType( - serialized_name="disabledSslProtocols", - ) - ssl_policy.min_protocol_version = AAZStrType( - serialized_name="minProtocolVersion", - ) - ssl_policy.policy_name = AAZStrType( - serialized_name="policyName", - ) - ssl_policy.policy_type = AAZStrType( - serialized_name="policyType", - ) - - cipher_suites = cls._schema_on_200.properties.ssl_policy.cipher_suites - cipher_suites.Element = AAZStrType() - - disabled_ssl_protocols = cls._schema_on_200.properties.ssl_policy.disabled_ssl_protocols - disabled_ssl_protocols.Element = AAZStrType() - - url_path_maps = cls._schema_on_200.properties.url_path_maps - url_path_maps.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.url_path_maps.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.url_path_maps.Element.properties - properties.default_backend_address_pool = AAZObjectType( - serialized_name="defaultBackendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_backend_address_pool) - properties.default_backend_http_settings = AAZObjectType( - serialized_name="defaultBackendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_backend_http_settings) - properties.default_redirect_configuration = AAZObjectType( - serialized_name="defaultRedirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_redirect_configuration) - properties.path_rules = AAZListType( - serialized_name="pathRules", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - path_rules = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules - path_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_http_settings = AAZObjectType( - serialized_name="backendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_http_settings) - properties.paths = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configuration = AAZObjectType( - serialized_name="redirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.redirect_configuration) - - paths = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element.properties.paths - paths.Element = AAZStrType() - - web_application_firewall_configuration = cls._schema_on_200.properties.web_application_firewall_configuration - web_application_firewall_configuration.disabled_rule_groups = AAZListType( - serialized_name="disabledRuleGroups", - ) - web_application_firewall_configuration.enabled = AAZBoolType( - flags={"required": True}, - ) - web_application_firewall_configuration.firewall_mode = AAZStrType( - serialized_name="firewallMode", - flags={"required": True}, - ) - web_application_firewall_configuration.rule_set_type = AAZStrType( - serialized_name="ruleSetType", - flags={"required": True}, - ) - web_application_firewall_configuration.rule_set_version = AAZStrType( - serialized_name="ruleSetVersion", - flags={"required": True}, - ) - - disabled_rule_groups = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups - disabled_rule_groups.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups.Element - _element.rule_group_name = AAZStrType( - serialized_name="ruleGroupName", - flags={"required": True}, - ) - _element.rules = AAZListType() - - rules = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups.Element.rules - rules.Element = AAZIntType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_gateway_backend_address_pool_read = None - - @classmethod - def _build_schema_application_gateway_backend_address_pool_read(cls, _schema): - if cls._schema_application_gateway_backend_address_pool_read is not None: - _schema.etag = cls._schema_application_gateway_backend_address_pool_read.etag - _schema.id = cls._schema_application_gateway_backend_address_pool_read.id - _schema.name = cls._schema_application_gateway_backend_address_pool_read.name - _schema.properties = cls._schema_application_gateway_backend_address_pool_read.properties - _schema.type = cls._schema_application_gateway_backend_address_pool_read.type - return - - cls._schema_application_gateway_backend_address_pool_read = _schema_application_gateway_backend_address_pool_read = AAZObjectType() - - application_gateway_backend_address_pool_read = _schema_application_gateway_backend_address_pool_read - application_gateway_backend_address_pool_read.etag = AAZStrType() - application_gateway_backend_address_pool_read.id = AAZStrType() - application_gateway_backend_address_pool_read.name = AAZStrType() - application_gateway_backend_address_pool_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_gateway_backend_address_pool_read.type = AAZStrType() - - properties = _schema_application_gateway_backend_address_pool_read.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_application_gateway_backend_address_pool_read.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_application_gateway_backend_address_pool_read.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_application_gateway_backend_address_pool_read.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - _schema.etag = cls._schema_application_gateway_backend_address_pool_read.etag - _schema.id = cls._schema_application_gateway_backend_address_pool_read.id - _schema.name = cls._schema_application_gateway_backend_address_pool_read.name - _schema.properties = cls._schema_application_gateway_backend_address_pool_read.properties - _schema.type = cls._schema_application_gateway_backend_address_pool_read.type - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - cls._build_schema_application_gateway_backend_address_pool_read(application_gateway_backend_address_pools.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/__cmd_group.py deleted file mode 100644 index 9b5c68b709c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage and configure load balancers. - - To learn more about Azure Load Balancer visit https://learn.microsoft.com/en-us/azure/load-balancer/quickstart-load-balancer-standard-public-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/__init__.py deleted file mode 100644 index 28d5f355813..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/_show.py deleted file mode 100644 index 7c7a87047e3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/lb/_show.py +++ /dev/null @@ -1,1250 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a load balancer. - - :example: Get the details of a load balancer. - az network lb show -g MyResourceGroup -n MyLb - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/loadbalancers/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The load balancer name.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.LoadBalancersGet(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 LoadBalancersGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "loadBalancerName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType() - _schema_on_200.id = AAZStrType() - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.backend_address_pools = AAZListType( - serialized_name="backendAddressPools", - ) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - ) - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rules = AAZListType( - serialized_name="outboundNatRules", - ) - properties.probes = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - backend_address_pools = cls._schema_on_200.properties.backend_address_pools - backend_address_pools.Element = AAZObjectType() - _ShowHelper._build_schema_backend_address_pool_read(backend_address_pools.Element) - - frontend_ip_configurations = cls._schema_on_200.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.frontend_ip_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rules = AAZListType( - serialized_name="outboundNatRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - _ShowHelper._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - _ShowHelper._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_nat_rules = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties.outbound_nat_rules - outbound_nat_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(outbound_nat_rules.Element) - - zones = cls._schema_on_200.properties.frontend_ip_configurations.Element.zones - zones.Element = AAZStrType() - - inbound_nat_pools = cls._schema_on_200.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.inbound_nat_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.inbound_nat_pools.Element.properties - properties.backend_port = AAZIntType( - serialized_name="backendPort", - flags={"required": True}, - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port_range_end = AAZIntType( - serialized_name="frontendPortRangeEnd", - flags={"required": True}, - ) - properties.frontend_port_range_start = AAZIntType( - serialized_name="frontendPortRangeStart", - flags={"required": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - inbound_nat_rules = cls._schema_on_200.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - _ShowHelper._build_schema_inbound_nat_rule_read(inbound_nat_rules.Element) - - load_balancing_rules = cls._schema_on_200.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.load_balancing_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.load_balancing_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.disable_outbound_snat = AAZBoolType( - serialized_name="disableOutboundSnat", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - flags={"required": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.load_distribution = AAZStrType( - serialized_name="loadDistribution", - ) - properties.probe = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.probe) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - outbound_nat_rules = cls._schema_on_200.properties.outbound_nat_rules - outbound_nat_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.outbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.outbound_nat_rules.Element.properties - properties.allocated_outbound_ports = AAZIntType( - serialized_name="allocatedOutboundPorts", - ) - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - flags={"required": True}, - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - frontend_ip_configurations = cls._schema_on_200.properties.outbound_nat_rules.Element.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(frontend_ip_configurations.Element) - - probes = cls._schema_on_200.properties.probes - probes.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.probes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.probes.Element.properties - properties.interval_in_seconds = AAZIntType( - serialized_name="intervalInSeconds", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.number_of_probes = AAZIntType( - serialized_name="numberOfProbes", - ) - properties.port = AAZIntType( - flags={"required": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.request_path = AAZStrType( - serialized_name="requestPath", - ) - - load_balancing_rules = cls._schema_on_200.properties.probes.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(load_balancing_rules.Element) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_backend_address_pool_read = None - - @classmethod - def _build_schema_backend_address_pool_read(cls, _schema): - if cls._schema_backend_address_pool_read is not None: - _schema.etag = cls._schema_backend_address_pool_read.etag - _schema.id = cls._schema_backend_address_pool_read.id - _schema.name = cls._schema_backend_address_pool_read.name - _schema.properties = cls._schema_backend_address_pool_read.properties - return - - cls._schema_backend_address_pool_read = _schema_backend_address_pool_read = AAZObjectType() - - backend_address_pool_read = _schema_backend_address_pool_read - backend_address_pool_read.etag = AAZStrType() - backend_address_pool_read.id = AAZStrType() - backend_address_pool_read.name = AAZStrType() - backend_address_pool_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_backend_address_pool_read.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_backend_address_pool_read.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_backend_address_pool_read.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - _schema.etag = cls._schema_backend_address_pool_read.etag - _schema.id = cls._schema_backend_address_pool_read.id - _schema.name = cls._schema_backend_address_pool_read.name - _schema.properties = cls._schema_backend_address_pool_read.properties - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_inbound_nat_rule_read = None - - @classmethod - def _build_schema_inbound_nat_rule_read(cls, _schema): - if cls._schema_inbound_nat_rule_read is not None: - _schema.etag = cls._schema_inbound_nat_rule_read.etag - _schema.id = cls._schema_inbound_nat_rule_read.id - _schema.name = cls._schema_inbound_nat_rule_read.name - _schema.properties = cls._schema_inbound_nat_rule_read.properties - return - - cls._schema_inbound_nat_rule_read = _schema_inbound_nat_rule_read = AAZObjectType() - - inbound_nat_rule_read = _schema_inbound_nat_rule_read - inbound_nat_rule_read.etag = AAZStrType() - inbound_nat_rule_read.id = AAZStrType() - inbound_nat_rule_read.name = AAZStrType() - inbound_nat_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_inbound_nat_rule_read.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_inbound_nat_rule_read.etag - _schema.id = cls._schema_inbound_nat_rule_read.id - _schema.name = cls._schema_inbound_nat_rule_read.name - _schema.properties = cls._schema_inbound_nat_rule_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - cls._build_schema_backend_address_pool_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_inbound_nat_rule_read(load_balancer_inbound_nat_rules.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/__cmd_group.py deleted file mode 100644 index 7d71d8c1f92..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage network interfaces. - - To learn more about network interfaces in Azure, visit https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-network-interface?tabs=network-interface-portal. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/__init__.py deleted file mode 100644 index bee768f7653..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_list.py deleted file mode 100644 index cdf91db918a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_list.py +++ /dev/null @@ -1,1049 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List network interfaces. - - To list network interfaces attached to VMs in VM scale sets use `az vmss nic list` or `az vmss nic list-vm-nics`. - - :example: List all NICs by internal DNS suffix. - az network nic list --query "[?dnsSettings.internalDomainNameSuffix=`{dnsSuffix}`]" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/networkinterfaces", "2017-10-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces", "2017-10-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.NetworkInterfacesList(ctx=self.ctx)() - if condition_1: - self.NetworkInterfacesListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - flags={"read_only": True}, - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - class NetworkInterfacesListAll(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.Network/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - flags={"read_only": True}, - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_show.py deleted file mode 100644 index 94591bd747f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_show.py +++ /dev/null @@ -1,965 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a network interface. - - :example: Get the internal domain name suffix of a NIC. - az network nic show -g MyResourceGroup -n MyNic --query "dnsSettings.internalDomainNameSuffix" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network interface (NIC).", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGet(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 NetworkInterfacesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_update.py deleted file mode 100644 index 1b229be9d16..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nic/_update.py +++ /dev/null @@ -1,2047 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Update(AAZCommand): - """Update a network interface. - - :example: Update a network interface to use a different network security group. - az network nic update -g MyResourceGroup -n MyNic --network-security-group MyNewNsg - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network interface (NIC).", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.accelerated_networking = AAZBoolArg( - options=["--accelerated-networking"], - help="Whether to enable accelerated networking.", - nullable=True, - ) - _args_schema.ip_forwarding = AAZBoolArg( - options=["--ip-forwarding"], - help="Whether to enable IP forwarding.", - nullable=True, - ) - - # define Arg Group "DNS" - - _args_schema = cls._args_schema - _args_schema.dns_servers = AAZListArg( - options=["--dns-servers"], - arg_group="DNS", - help="Space-separated list of DNS server IP addresses. Use null to revert to default Azure servers.", - nullable=True, - ) - _args_schema.internal_dns_name = AAZStrArg( - options=["--internal-dns-name"], - arg_group="DNS", - help="Name of internal DNS label.", - nullable=True, - ) - - dns_servers = cls._args_schema.dns_servers - dns_servers.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "DnsSettings" - - # define Arg Group "Parameters" - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.nsg = AAZObjectArg( - options=["--nsg"], - arg_group="Properties", - help="The reference to the NetworkSecurityGroup resource.", - nullable=True, - ) - - nsg = cls._args_schema.nsg - nsg.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - nsg.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - nsg.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - nsg.default_security_rules = AAZListArg( - options=["default-security-rules"], - help="The default security rules of network security group.", - nullable=True, - ) - nsg.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - nsg.resource_guid = AAZStrArg( - options=["resource-guid"], - help="The resource GUID property of the network security group resource.", - nullable=True, - ) - nsg.security_rules = AAZListArg( - options=["security-rules"], - help="A collection of security rules of the network security group.", - nullable=True, - ) - nsg.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - default_security_rules = cls._args_schema.nsg.default_security_rules - default_security_rules.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_security_rule_update(default_security_rules.Element) - - security_rules = cls._args_schema.nsg.security_rules - security_rules.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.nsg.security_rules.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - _element.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - _element.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - _element.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - _element.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - _element.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _element.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - _element.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - _element.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.", - nullable=True, - ) - _element.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - _element.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - _element.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_schema.nsg.security_rules.Element.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_schema.nsg.security_rules.Element.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_schema.nsg.security_rules.Element.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_schema.nsg.security_rules.Element.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_schema.nsg.security_rules.Element.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_schema.nsg.security_rules.Element.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_schema.nsg.tags - tags.Element = AAZStrArg( - nullable=True, - ) - return cls._args_schema - - _args_application_security_group_update = None - - @classmethod - def _build_args_application_security_group_update(cls, _schema): - if cls._args_application_security_group_update is not None: - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - return - - cls._args_application_security_group_update = AAZObjectArg( - nullable=True, - ) - - application_security_group_update = cls._args_application_security_group_update - application_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_application_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - - _args_network_security_group_update = None - - @classmethod - def _build_args_network_security_group_update(cls, _schema): - if cls._args_network_security_group_update is not None: - _schema.default_security_rules = cls._args_network_security_group_update.default_security_rules - _schema.etag = cls._args_network_security_group_update.etag - _schema.id = cls._args_network_security_group_update.id - _schema.location = cls._args_network_security_group_update.location - _schema.provisioning_state = cls._args_network_security_group_update.provisioning_state - _schema.resource_guid = cls._args_network_security_group_update.resource_guid - _schema.security_rules = cls._args_network_security_group_update.security_rules - _schema.tags = cls._args_network_security_group_update.tags - return - - cls._args_network_security_group_update = AAZObjectArg( - nullable=True, - ) - - network_security_group_update = cls._args_network_security_group_update - network_security_group_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - network_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - network_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - network_security_group_update.default_security_rules = AAZListArg( - options=["default-security-rules"], - help="The default security rules of network security group.", - nullable=True, - ) - network_security_group_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - network_security_group_update.resource_guid = AAZStrArg( - options=["resource-guid"], - help="The resource GUID property of the network security group resource.", - nullable=True, - ) - network_security_group_update.security_rules = AAZListArg( - options=["security-rules"], - help="A collection of security rules of the network security group.", - nullable=True, - ) - network_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - default_security_rules = cls._args_network_security_group_update.default_security_rules - default_security_rules.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_security_rule_update(default_security_rules.Element) - - security_rules = cls._args_network_security_group_update.security_rules - security_rules.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_network_security_group_update.security_rules.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - _element.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - _element.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - _element.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - _element.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - _element.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _element.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - _element.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - _element.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - _element.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - _element.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - _element.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_network_security_group_update.security_rules.Element.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_network_security_group_update.security_rules.Element.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_network_security_group_update.security_rules.Element.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_network_security_group_update.security_rules.Element.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_network_security_group_update.security_rules.Element.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_network_security_group_update.security_rules.Element.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_network_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.default_security_rules = cls._args_network_security_group_update.default_security_rules - _schema.etag = cls._args_network_security_group_update.etag - _schema.id = cls._args_network_security_group_update.id - _schema.location = cls._args_network_security_group_update.location - _schema.provisioning_state = cls._args_network_security_group_update.provisioning_state - _schema.resource_guid = cls._args_network_security_group_update.resource_guid - _schema.security_rules = cls._args_network_security_group_update.security_rules - _schema.tags = cls._args_network_security_group_update.tags - - _args_security_rule_update = None - - @classmethod - def _build_args_security_rule_update(cls, _schema): - if cls._args_security_rule_update is not None: - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - return - - cls._args_security_rule_update = AAZObjectArg( - nullable=True, - ) - - security_rule_update = cls._args_security_rule_update - security_rule_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - security_rule_update.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - security_rule_update.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_update.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - security_rule_update.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - security_rule_update.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - security_rule_update.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - security_rule_update.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - security_rule_update.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_update.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - security_rule_update.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - security_rule_update.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - security_rule_update.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - security_rule_update.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - security_rule_update.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_update.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - - _args_sub_resource_update = None - - @classmethod - def _build_args_sub_resource_update(cls, _schema): - if cls._args_sub_resource_update is not None: - _schema.id = cls._args_sub_resource_update.id - return - - cls._args_sub_resource_update = AAZObjectArg( - nullable=True, - ) - - sub_resource_update = cls._args_sub_resource_update - sub_resource_update.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - - _schema.id = cls._args_sub_resource_update.id - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.NetworkInterfacesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class NetworkInterfacesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - class NetworkInterfacesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_network_interface_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("dnsSettings", AAZObjectType) - properties.set_prop("enableAcceleratedNetworking", AAZBoolType, ".accelerated_networking") - properties.set_prop("enableIPForwarding", AAZBoolType, ".ip_forwarding") - properties.set_prop("networkSecurityGroup", AAZObjectType, ".nsg") - - dns_settings = _builder.get(".properties.dnsSettings") - if dns_settings is not None: - dns_settings.set_prop("dnsServers", AAZListType, ".dns_servers") - dns_settings.set_prop("internalDnsNameLabel", AAZStrType, ".internal_dns_name") - - dns_servers = _builder.get(".properties.dnsSettings.dnsServers") - if dns_servers is not None: - dns_servers.set_elements(AAZStrType, ".") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("etag", AAZStrType, ".etag") - network_security_group.set_prop("id", AAZStrType, ".id") - network_security_group.set_prop("location", AAZStrType, ".location") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - network_security_group.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties.networkSecurityGroup.properties") - if properties is not None: - properties.set_prop("defaultSecurityRules", AAZListType, ".default_security_rules") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("resourceGuid", AAZStrType, ".resource_guid") - properties.set_prop("securityRules", AAZListType, ".security_rules") - - default_security_rules = _builder.get(".properties.networkSecurityGroup.properties.defaultSecurityRules") - if default_security_rules is not None: - _UpdateHelper._build_schema_security_rule_update(default_security_rules.set_elements(AAZObjectType, ".")) - - security_rules = _builder.get(".properties.networkSecurityGroup.properties.securityRules") - if security_rules is not None: - security_rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.networkSecurityGroup.properties.securityRules[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - _UpdateHelper._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - _UpdateHelper._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - tags = _builder.get(".properties.networkSecurityGroup.tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_application_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_network_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("defaultSecurityRules", AAZListType, ".default_security_rules") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("resourceGuid", AAZStrType, ".resource_guid") - properties.set_prop("securityRules", AAZListType, ".security_rules") - - default_security_rules = _builder.get(".properties.defaultSecurityRules") - if default_security_rules is not None: - cls._build_schema_security_rule_update(default_security_rules.set_elements(AAZObjectType, ".")) - - security_rules = _builder.get(".properties.securityRules") - if security_rules is not None: - security_rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.securityRules[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.securityRules[].properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.securityRules[].properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.securityRules[].properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.securityRules[].properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.securityRules[].properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.securityRules[].properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.securityRules[].properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_sub_resource_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/__cmd_group.py deleted file mode 100644 index 22ad607bc90..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage Azure Network Security Groups (NSGs). - - You can control network traffic to resources in a virtual network using a network security group. A network security group contains a list of security rules that allow or deny inbound or outbound network traffic based on source or destination IP addresses, Application Security Groups, ports, and protocols. For more information visit https://learn.microsoft.com/azure/virtual-network/virtual-networks-create-nsg-arm-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/__init__.py deleted file mode 100644 index 4fbda4a6e7a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/_create.py deleted file mode 100644 index 05596df4e8f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/_create.py +++ /dev/null @@ -1,1230 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a network security group. - - :example: Create an NSG in a resource group within a region with tags. - az network nsg create -g MyResourceGroup -n MyNsg --tags foo=bar - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - help="Space-separated tags: key[=value] [key[=value] ...].", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Parameters" - - # define Arg Group "Properties" - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - _args_security_rule_create = None - - @classmethod - def _build_args_security_rule_create(cls, _schema): - if cls._args_security_rule_create is not None: - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - return - - cls._args_security_rule_create = AAZObjectArg() - - security_rule_create = cls._args_security_rule_create - security_rule_create.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - ) - security_rule_create.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - ) - security_rule_create.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_create.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - ) - security_rule_create.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - security_rule_create.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - ) - security_rule_create.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - ) - security_rule_create.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - ) - security_rule_create.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_create.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - security_rule_create.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_create.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - ) - security_rule_create.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - ) - security_rule_create.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - ) - security_rule_create.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - ) - security_rule_create.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - ) - - destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_create.source_port_ranges - source_port_ranges.Element = AAZStrArg() - - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - yield self.NetworkSecurityGroupsCreateOrUpdate(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 NetworkSecurityGroupsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - 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("location", AAZStrType, ".location") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_network_security_group_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/_show.py deleted file mode 100644 index f395c7c8c82..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/_show.py +++ /dev/null @@ -1,945 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get information about a network security group. - - :example: Get basic information about an NSG. - az network nsg show -g MyResourceGroup -n MyNsg - - :example: Get the default security rules of an NSG and format the output as a table. - az network nsg show -g MyResourceGroup -n MyNsg --query "defaultSecurityRules[]" -o table - - :example: Get all default NSG rules with "Allow" access and format the output as a table. - az network nsg show -g MyResourceGroup -n MyNsg --query "defaultSecurityRules[?access=='Allow']" -o table - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkSecurityGroupsGet(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 NetworkSecurityGroupsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_security_group_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/__cmd_group.py deleted file mode 100644 index 6e93e97c0d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/__cmd_group.py +++ /dev/null @@ -1,20 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage network security group rules. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/__init__.py deleted file mode 100644 index a6df9f5a835..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/_create.py deleted file mode 100644 index 3bdca191c8d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/nsg/rule/_create.py +++ /dev/null @@ -1,541 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a network security group rule. - - :example: Create a basic "Allow" NSG rule with the highest priority. - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule --priority 100 - - :example: Create a "Deny" rule over TCP for a specific IP address range with the lowest priority. - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule --priority 4096 --source-address-prefixes 208.130.28.0/24 --source-port-ranges 80 --destination-address-prefixes '*' --destination-port-ranges 80 8080 --access Deny --protocol Tcp --description "Deny from specific IP address ranges on 80 and 8080." - - :example: Create a security rule using service tags (https://aka.ms/servicetags). - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRuleWithTags --priority 400 --source-address-prefixes VirtualNetwork --destination-address-prefixes Storage --destination-port-ranges '*' --direction Outbound --access Allow --protocol Tcp --description "Allow VirtualNetwork to Storage." - - :example: Create a security rule using application security groups (https://aka.ms/applicationsecuritygroups). - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRuleWithAsg --priority 500 --source-address-prefixes Internet --destination-port-ranges 80 8080 --destination-asgs Web --access Allow --protocol Tcp --description "Allow Internet to Web ASG on ports 80,8080." - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}/securityrules/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.nsg_name = AAZStrArg( - options=["--nsg-name"], - help="Name of the network security group.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group rule.", - required=True, - ) - _args_schema.access = AAZStrArg( - options=["--access"], - help="Network traffic is allowed or denied.", - default="Allow", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _args_schema.description = AAZStrArg( - options=["--description"], - help="Description for this rule. Restricted to 140 chars.", - ) - _args_schema.direction = AAZStrArg( - options=["--direction"], - help="Direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.", - default="Inbound", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _args_schema.priority = AAZIntArg( - options=["--priority"], - help="Priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - _args_schema.protocol = AAZStrArg( - options=["--protocol"], - help="Network protocol this rule applies to.", - default="*", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - - # define Arg Group "Destination" - - _args_schema = cls._args_schema - _args_schema.destination_address_prefix = AAZStrArg( - options=["--destination-address-prefix"], - arg_group="Destination", - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - _args_schema.destination_address_prefixes = AAZListArg( - options=["--destination-address-prefixes"], - arg_group="Destination", - help="Space-separated list of CIDR prefixes or IP ranges. Alternatively, specify ONE of 'VirtualNetwork', 'AzureLoadBalancer', 'Internet' or '*' to match all IPs. Besides, it also supports all available Service Tags like 'ApiManagement', 'SqlManagement', 'AzureMonitor', etc.", - default=["*"], - ) - _args_schema.destination_application_security_groups = AAZListArg( - options=["--destination-application-security-groups"], - arg_group="Destination", - help="Application security group specified as destination.", - ) - _args_schema.destination_port_range = AAZStrArg( - options=["--destination-port-range"], - arg_group="Destination", - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - ) - _args_schema.destination_port_ranges = AAZListArg( - options=["--destination-port-ranges"], - arg_group="Destination", - help="Space-separated list of ports or port ranges between 0-65535. Use '*' to match all ports.", - default=["80"], - ) - - destination_address_prefixes = cls._args_schema.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_schema.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_schema.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - # define Arg Group "Properties" - - # define Arg Group "SecurityRuleParameters" - - # define Arg Group "Source" - - _args_schema = cls._args_schema - _args_schema.source_address_prefix = AAZStrArg( - options=["--source-address-prefix"], - arg_group="Source", - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.", - ) - _args_schema.source_address_prefixes = AAZListArg( - options=["--source-address-prefixes"], - arg_group="Source", - help="Space-separated list of CIDR prefixes or IP ranges. Alternatively, specify ONE of 'VirtualNetwork', 'AzureLoadBalancer', 'Internet' or '*' to match all IPs. Besides, it also supports all available Service Tags like 'ApiManagement', 'SqlManagement', 'AzureMonitor', etc.", - default=["*"], - ) - _args_schema.source_application_security_groups = AAZListArg( - options=["--source-application-security-groups"], - arg_group="Source", - help="Application security group specified as source.", - ) - _args_schema.source_port_range = AAZStrArg( - options=["--source-port-range"], - arg_group="Source", - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - ) - _args_schema.source_port_ranges = AAZListArg( - options=["--source-port-ranges"], - arg_group="Source", - help="Space-separated list of ports or port ranges between 0-65535. Use '*' to match all ports.", - default=["*"], - ) - - source_address_prefixes = cls._args_schema.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_schema.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_schema.source_port_ranges - source_port_ranges.Element = AAZStrArg() - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - def _execute_operations(self): - self.pre_operations() - yield self.SecurityRulesCreateOrUpdate(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 SecurityRulesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.nsg_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "securityRuleName", self.ctx.args.name, - required=True, - ), - **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", "2017-10-01", - 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") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - _CreateHelper._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - _CreateHelper._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.etag = AAZStrType() - _schema_on_200_201.id = AAZStrType() - _schema_on_200_201.name = AAZStrType() - _schema_on_200_201.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = cls._schema_on_200_201.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = cls._schema_on_200_201.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - _CreateHelper._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = cls._schema_on_200_201.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = cls._schema_on_200_201.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = cls._schema_on_200_201.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - _CreateHelper._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = cls._schema_on_200_201.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/__cmd_group.py deleted file mode 100644 index 2557faf7887..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage public IP addresses. - - To learn more about public IP addresses visit https://learn.microsoft.com/azure/virtual-network/virtual-network-public-ip-address. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/__init__.py deleted file mode 100644 index 2df85698253..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/_list.py deleted file mode 100644 index 0c48b502a54..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/_list.py +++ /dev/null @@ -1,1278 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List public IP addresses. - - :example: List all public IPs in a subscription. - az network public-ip list - - :example: List all public IPs in a resource group. - az network public-ip list -g MyResourceGroup - - :example: List all public IPs of a domain name label. - az network public-ip list -g MyResourceGroup --query "[?dnsSettings.domainNameLabel=='MyLabel']" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/publicipaddresses", "2017-10-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/publicipaddresses", "2017-10-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.PublicIPAddressesList(ctx=self.ctx)() - if condition_1: - self.PublicIPAddressesListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class PublicIPAddressesList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - class PublicIPAddressesListAll(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.Network/publicIPAddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType( - flags={"read_only": True} - ) - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.location = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - application_security_group_read.tags = AAZDictType( - flags={"read_only": True}, - ) - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType( - flags={"read_only": True} - ) - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.id = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.name = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - flags={"read_only": True}, - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType( - flags={"read_only": True} - ) - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.id = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - flags={"read_only": True}, - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - flags={"read_only": True}, - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - flags={"read_only": True}, - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - flags={"read_only": True}, - ) - properties.primary = AAZBoolType( - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - flags={"read_only": True}, - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - flags={"read_only": True}, - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - flags={"read_only": True}, - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType( - flags={"read_only": True}, - ) - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - flags={"read_only": True}, - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - flags={"read_only": True}, - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - flags={"read_only": True}, - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - flags={"read_only": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - flags={"read_only": True}, - ) - properties.protocol = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType( - flags={"read_only": True} - ) - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.location = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - network_security_group_read.tags = AAZDictType( - flags={"read_only": True}, - ) - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - flags={"read_only": True}, - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - flags={"read_only": True}, - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - _element.tags = AAZDictType( - flags={"read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - flags={"read_only": True}, - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - flags={"read_only": True}, - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - flags={"read_only": True}, - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - flags={"read_only": True}, - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - flags={"read_only": True}, - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - flags={"read_only": True}, - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - flags={"read_only": True}, - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - flags={"read_only": True}, - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType( - flags={"read_only": True}, - ) - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType( - flags={"read_only": True}, - ) - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType( - flags={"read_only": True} - ) - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.id = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.name = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.description = AAZStrType( - flags={"read_only": True}, - ) - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"read_only": True}, - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - flags={"read_only": True}, - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - flags={"read_only": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - flags={"read_only": True}, - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - flags={"read_only": True}, - ) - properties.direction = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.priority = AAZIntType( - flags={"read_only": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"read_only": True}, - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - flags={"read_only": True}, - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - flags={"read_only": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - flags={"read_only": True}, - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - flags={"read_only": True}, - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType( - flags={"read_only": True}, - ) - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType( - flags={"read_only": True}, - ) - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType( - flags={"read_only": True}, - ) - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType( - flags={"read_only": True} - ) - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType( - flags={"read_only": True}, - ) - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType( - flags={"read_only": True} - ) - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.id = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.name = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - flags={"read_only": True}, - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - flags={"read_only": True}, - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - flags={"read_only": True}, - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - flags={"read_only": True}, - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType( - flags={"read_only": True}, - ) - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType( - flags={"read_only": True}, - ) - route_table.id = AAZStrType( - flags={"read_only": True}, - ) - route_table.location = AAZStrType( - flags={"read_only": True}, - ) - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - route_table.tags = AAZDictType( - flags={"read_only": True}, - ) - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.routes = AAZListType( - flags={"read_only": True}, - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - flags={"read_only": True}, - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - flags={"read_only": True}, - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True, "read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType( - flags={"read_only": True}, - ) - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - _element.service = AAZStrType( - flags={"read_only": True}, - ) - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/_show.py deleted file mode 100644 index 175a59c1235..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/public_ip/_show.py +++ /dev/null @@ -1,1195 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a public IP address. - - :example: Get information about a public IP resource. - az network public-ip show -g MyResourceGroup -n MyIp - - :example: Get the FQDN and IP address of a public IP resource. - az network public-ip show -g MyResourceGroup -n MyIp --query "{fqdn: dnsSettings.fqdn,address: ipAddress}" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/publicipaddresses/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the public IP address.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PublicIPAddressesGet(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 PublicIPAddressesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "publicIpAddressName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_public_ip_address_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType( - flags={"read_only": True} - ) - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.location = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - application_security_group_read.tags = AAZDictType( - flags={"read_only": True}, - ) - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType( - flags={"read_only": True} - ) - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.id = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.name = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - flags={"read_only": True}, - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType( - flags={"read_only": True} - ) - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.id = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - flags={"read_only": True}, - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - flags={"read_only": True}, - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - flags={"read_only": True}, - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - flags={"read_only": True}, - ) - properties.primary = AAZBoolType( - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - flags={"read_only": True}, - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - flags={"read_only": True}, - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - flags={"read_only": True}, - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType( - flags={"read_only": True}, - ) - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - flags={"read_only": True}, - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - flags={"read_only": True}, - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - flags={"read_only": True}, - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - flags={"read_only": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - flags={"read_only": True}, - ) - properties.protocol = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType( - flags={"read_only": True} - ) - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.location = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - network_security_group_read.tags = AAZDictType( - flags={"read_only": True}, - ) - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - flags={"read_only": True}, - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - flags={"read_only": True}, - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - _element.tags = AAZDictType( - flags={"read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - flags={"read_only": True}, - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - flags={"read_only": True}, - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - flags={"read_only": True}, - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - flags={"read_only": True}, - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - flags={"read_only": True}, - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - flags={"read_only": True}, - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - flags={"read_only": True}, - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - flags={"read_only": True}, - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType( - flags={"read_only": True}, - ) - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType( - flags={"read_only": True}, - ) - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType( - flags={"read_only": True} - ) - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.id = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.name = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.description = AAZStrType( - flags={"read_only": True}, - ) - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"read_only": True}, - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - flags={"read_only": True}, - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - flags={"read_only": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - flags={"read_only": True}, - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - flags={"read_only": True}, - ) - properties.direction = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.priority = AAZIntType( - flags={"read_only": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"read_only": True}, - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - flags={"read_only": True}, - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - flags={"read_only": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - flags={"read_only": True}, - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - flags={"read_only": True}, - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType( - flags={"read_only": True}, - ) - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType( - flags={"read_only": True}, - ) - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType( - flags={"read_only": True}, - ) - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType( - flags={"read_only": True} - ) - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType( - flags={"read_only": True}, - ) - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType( - flags={"read_only": True} - ) - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.id = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.name = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - flags={"read_only": True}, - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - flags={"read_only": True}, - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - flags={"read_only": True}, - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - flags={"read_only": True}, - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType( - flags={"read_only": True}, - ) - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType( - flags={"read_only": True}, - ) - route_table.id = AAZStrType( - flags={"read_only": True}, - ) - route_table.location = AAZStrType( - flags={"read_only": True}, - ) - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - route_table.tags = AAZDictType( - flags={"read_only": True}, - ) - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.routes = AAZListType( - flags={"read_only": True}, - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - flags={"read_only": True}, - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - flags={"read_only": True}, - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True, "read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType( - flags={"read_only": True}, - ) - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - _element.service = AAZStrType( - flags={"read_only": True}, - ) - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/__cmd_group.py deleted file mode 100644 index 73d2004eb91..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Check if a private IP address is available for use within a virtual network. - - To learn more about Virtual Networks visit https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-network. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/__init__.py deleted file mode 100644 index d63ae5a6fc9..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/_list.py deleted file mode 100644 index 10af87394a2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/_list.py +++ /dev/null @@ -1,1231 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List virtual networks. - - :example: List all virtual networks in a subscription. - az network vnet list - - :example: List all virtual networks in a resource group. - az network vnet list -g MyResourceGroup - - :example: List virtual networks in a subscription which specify a certain address prefix. - az network vnet list --query "[?contains(addressSpace.addressPrefixes, '10.0.0.0/16')]" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/virtualnetworks", "2017-10-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks", "2017-10-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.VirtualNetworksList(ctx=self.ctx)() - if condition_1: - self.VirtualNetworksListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualNetworksList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.address_space = AAZObjectType( - serialized_name="addressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.address_space) - properties.dhcp_options = AAZObjectType( - serialized_name="dhcpOptions", - ) - properties.enable_ddos_protection = AAZBoolType( - serialized_name="enableDdosProtection", - ) - properties.enable_vm_protection = AAZBoolType( - serialized_name="enableVmProtection", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.subnets = AAZListType() - properties.virtual_network_peerings = AAZListType( - serialized_name="virtualNetworkPeerings", - ) - - dhcp_options = cls._schema_on_200.value.Element.properties.dhcp_options - dhcp_options.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.dhcp_options.dns_servers - dns_servers.Element = AAZStrType() - - subnets = cls._schema_on_200.value.Element.properties.subnets - subnets.Element = AAZObjectType() - _ListHelper._build_schema_subnet_read(subnets.Element) - - virtual_network_peerings = cls._schema_on_200.value.Element.properties.virtual_network_peerings - virtual_network_peerings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element.properties - properties.allow_forwarded_traffic = AAZBoolType( - serialized_name="allowForwardedTraffic", - ) - properties.allow_gateway_transit = AAZBoolType( - serialized_name="allowGatewayTransit", - ) - properties.allow_virtual_network_access = AAZBoolType( - serialized_name="allowVirtualNetworkAccess", - ) - properties.peering_state = AAZStrType( - serialized_name="peeringState", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.remote_address_space = AAZObjectType( - serialized_name="remoteAddressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.remote_address_space) - properties.remote_virtual_network = AAZObjectType( - serialized_name="remoteVirtualNetwork", - ) - _ListHelper._build_schema_sub_resource_read(properties.remote_virtual_network) - properties.use_remote_gateways = AAZBoolType( - serialized_name="useRemoteGateways", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class VirtualNetworksListAll(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.Network/virtualNetworks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.address_space = AAZObjectType( - serialized_name="addressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.address_space) - properties.dhcp_options = AAZObjectType( - serialized_name="dhcpOptions", - ) - properties.enable_ddos_protection = AAZBoolType( - serialized_name="enableDdosProtection", - ) - properties.enable_vm_protection = AAZBoolType( - serialized_name="enableVmProtection", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.subnets = AAZListType() - properties.virtual_network_peerings = AAZListType( - serialized_name="virtualNetworkPeerings", - ) - - dhcp_options = cls._schema_on_200.value.Element.properties.dhcp_options - dhcp_options.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.dhcp_options.dns_servers - dns_servers.Element = AAZStrType() - - subnets = cls._schema_on_200.value.Element.properties.subnets - subnets.Element = AAZObjectType() - _ListHelper._build_schema_subnet_read(subnets.Element) - - virtual_network_peerings = cls._schema_on_200.value.Element.properties.virtual_network_peerings - virtual_network_peerings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element.properties - properties.allow_forwarded_traffic = AAZBoolType( - serialized_name="allowForwardedTraffic", - ) - properties.allow_gateway_transit = AAZBoolType( - serialized_name="allowGatewayTransit", - ) - properties.allow_virtual_network_access = AAZBoolType( - serialized_name="allowVirtualNetworkAccess", - ) - properties.peering_state = AAZStrType( - serialized_name="peeringState", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.remote_address_space = AAZObjectType( - serialized_name="remoteAddressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.remote_address_space) - properties.remote_virtual_network = AAZObjectType( - serialized_name="remoteVirtualNetwork", - ) - _ListHelper._build_schema_sub_resource_read(properties.remote_virtual_network) - properties.use_remote_gateways = AAZBoolType( - serialized_name="useRemoteGateways", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_address_space_read = None - - @classmethod - def _build_schema_address_space_read(cls, _schema): - if cls._schema_address_space_read is not None: - _schema.address_prefixes = cls._schema_address_space_read.address_prefixes - return - - cls._schema_address_space_read = _schema_address_space_read = AAZObjectType() - - address_space_read = _schema_address_space_read - address_space_read.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - - address_prefixes = _schema_address_space_read.address_prefixes - address_prefixes.Element = AAZStrType() - - _schema.address_prefixes = cls._schema_address_space_read.address_prefixes - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/__cmd_group.py deleted file mode 100644 index 748734c3253..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage subnets in an Azure Virtual Network. - - To learn more about subnets visit https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-subnet. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/__init__.py deleted file mode 100644 index 1fcc89bcaa3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_create.py deleted file mode 100644 index 9e9b3d755fe..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_create.py +++ /dev/null @@ -1,1301 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a subnet and associate an existing NSG and route table. - - :example: Create new subnet attached to an NSG with a custom route table. - az network vnet subnet create -g MyResourceGroup --vnet-name MyVnet -n MySubnet --address-prefixes 10.0.0.0/24 --network-security-group MyNsg --route-table MyRouteTable - - :example: Create new subnet attached to a NAT gateway. - az network vnet subnet create -n MySubnet --vnet-name MyVnet -g MyResourceGroup --nat-gateway MyNatGateway --address-prefixes "10.0.0.0/21" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - ) - _args_schema.address_prefix = AAZStrArg( - options=["--address-prefix"], - help="The address prefix for the subnet.", - ) - _args_schema.network_security_group = AAZResourceIdArg( - options=["--nsg", "--network-security-group"], - help="Name or ID of a network security group (NSG).", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - _args_schema.route_table = AAZResourceIdArg( - options=["--route-table"], - help="Name or ID of a route table to associate with the subnet.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", - ), - ) - _args_schema.endpoints = AAZListArg( - options=["--endpoints"], - help="An array of service endpoints.", - ) - - endpoints = cls._args_schema.endpoints - endpoints.Element = AAZObjectArg() - - _element = cls._args_schema.endpoints.Element - _element.locations = AAZListArg( - options=["locations"], - help="A list of locations.", - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource.", - ) - _element.service = AAZStrArg( - options=["service"], - help="The type of the endpoint service.", - ) - - locations = cls._args_schema.endpoints.Element.locations - locations.Element = AAZStrArg() - - # define Arg Group "NetworkSecurityGroup" - - # define Arg Group "Properties" - - # define Arg Group "RouteTable" - - # define Arg Group "SubnetParameters" - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - _args_security_rule_create = None - - @classmethod - def _build_args_security_rule_create(cls, _schema): - if cls._args_security_rule_create is not None: - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - return - - cls._args_security_rule_create = AAZObjectArg() - - security_rule_create = cls._args_security_rule_create - security_rule_create.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - ) - security_rule_create.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - ) - security_rule_create.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_create.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - ) - security_rule_create.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - security_rule_create.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - ) - security_rule_create.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - ) - security_rule_create.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - ) - security_rule_create.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_create.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - security_rule_create.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_create.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - ) - security_rule_create.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - ) - security_rule_create.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - ) - security_rule_create.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - ) - security_rule_create.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - ) - - destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_create.source_port_ranges - source_port_ranges.Element = AAZStrArg() - - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - yield self.SubnetsCreateOrUpdate(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 SubnetsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-10-01", - 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") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefix", AAZStrType, ".address_prefix") - properties.set_prop("networkSecurityGroup", AAZObjectType) - properties.set_prop("routeTable", AAZObjectType) - properties.set_prop("serviceEndpoints", AAZListType, ".endpoints") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("id", AAZStrType, ".network_security_group") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - route_table = _builder.get(".properties.routeTable") - if route_table is not None: - route_table.set_prop("id", AAZStrType, ".route_table") - route_table.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - service_endpoints = _builder.get(".properties.serviceEndpoints") - if service_endpoints is not None: - service_endpoints.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpoints[]") - if _elements is not None: - _elements.set_prop("locations", AAZListType, ".locations") - _elements.set_prop("provisioningState", AAZStrType, ".provisioning_state") - _elements.set_prop("service", AAZStrType, ".service") - - locations = _builder.get(".properties.serviceEndpoints[].locations") - if locations is not None: - locations.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_subnet_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_show.py deleted file mode 100644 index 4814783dfd0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_show.py +++ /dev/null @@ -1,949 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Show details of a subnet. - - :example: Show the details of a subnet associated with a virtual network. - az network vnet subnet show -g MyResourceGroup -n MySubnet --vnet-name MyVNet - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - id_part="child_name_1", - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - id_part="name", - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SubnetsGet(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 SubnetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_subnet_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_update.py deleted file mode 100644 index 52329fbf647..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/network/vnet/subnet/_update.py +++ /dev/null @@ -1,1479 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Update(AAZCommand): - """Update a subnet. - - :example: Associate a network security group to a subnet. - az network vnet subnet update -g MyResourceGroup -n MySubnet --vnet-name MyVNet --network-security-group MyNsg - - :example: Update subnet with NAT gateway. - az network vnet subnet update -n MySubnet --vnet-name MyVnet -g MyResourceGroup --nat-gateway MyNatGateway --address-prefixes "10.0.0.0/21" - - :example: Disable the private endpoint network policies - az network vnet subnet update -n MySubnet --vnet-name MyVnet -g MyResourceGroup --disable-private-endpoint-network-policies - - :example: Detach a network security group in a subnet. - az network vnet subnet update -g MyResourceGroup --vnet-name MyVNet -n MySubnet --nsg null - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - id_part="child_name_1", - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - id_part="name", - ) - _args_schema.address_prefix = AAZStrArg( - options=["--address-prefix"], - help="The address prefix for the subnet.", - nullable=True, - ) - _args_schema.network_security_group = AAZResourceIdArg( - options=["--nsg", "--network-security-group"], - help="Name or ID of a network security group (NSG). Use null to detach it.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - _args_schema.route_table = AAZResourceIdArg( - options=["--route-table"], - help="Name or ID of a route table to associate with the subnet. Use null to detach it.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", - ), - ) - _args_schema.endpoints = AAZListArg( - options=["--endpoints"], - help="An array of service endpoints.", - nullable=True, - ) - - endpoints = cls._args_schema.endpoints - endpoints.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.endpoints.Element - _element.locations = AAZListArg( - options=["locations"], - help="A list of locations.", - nullable=True, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource.", - nullable=True, - ) - _element.service = AAZStrArg( - options=["service"], - help="The type of the endpoint service.", - nullable=True, - ) - - locations = cls._args_schema.endpoints.Element.locations - locations.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "NetworkSecurityGroup" - - # define Arg Group "Properties" - - # define Arg Group "RouteTable" - - # define Arg Group "SubnetParameters" - return cls._args_schema - - _args_application_security_group_update = None - - @classmethod - def _build_args_application_security_group_update(cls, _schema): - if cls._args_application_security_group_update is not None: - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - return - - cls._args_application_security_group_update = AAZObjectArg( - nullable=True, - ) - - application_security_group_update = cls._args_application_security_group_update - application_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_application_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - - _args_security_rule_update = None - - @classmethod - def _build_args_security_rule_update(cls, _schema): - if cls._args_security_rule_update is not None: - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - return - - cls._args_security_rule_update = AAZObjectArg( - nullable=True, - ) - - security_rule_update = cls._args_security_rule_update - security_rule_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - security_rule_update.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - security_rule_update.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_update.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - security_rule_update.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - security_rule_update.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - security_rule_update.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - security_rule_update.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - security_rule_update.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_update.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - security_rule_update.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - security_rule_update.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - security_rule_update.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - security_rule_update.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - security_rule_update.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_update.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - self.SubnetsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.SubnetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class SubnetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_subnet_read(cls._schema_on_200) - - return cls._schema_on_200 - - class SubnetsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-10-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_subnet_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefix", AAZStrType, ".address_prefix") - properties.set_prop("networkSecurityGroup", AAZObjectType) - properties.set_prop("routeTable", AAZObjectType) - properties.set_prop("serviceEndpoints", AAZListType, ".endpoints") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("id", AAZStrType, ".network_security_group") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - route_table = _builder.get(".properties.routeTable") - if route_table is not None: - route_table.set_prop("id", AAZStrType, ".route_table") - route_table.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - service_endpoints = _builder.get(".properties.serviceEndpoints") - if service_endpoints is not None: - service_endpoints.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpoints[]") - if _elements is not None: - _elements.set_prop("locations", AAZListType, ".locations") - _elements.set_prop("provisioningState", AAZStrType, ".provisioning_state") - _elements.set_prop("service", AAZStrType, ".service") - - locations = _builder.get(".properties.serviceEndpoints[].locations") - if locations is not None: - locations.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_application_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/__cmd_group.py deleted file mode 100644 index f4c2f2afe19..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot", -) -class __CMDGroup(AAZCommandGroup): - """Manage point-in-time copies of managed disks, native blobs, or other snapshots. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/__init__.py deleted file mode 100644 index 59700973595..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._grant_access import * -from ._list import * -from ._revoke_access import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_create.py deleted file mode 100644 index 02df23d780e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_create.py +++ /dev/null @@ -1,541 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot create", -) -class Create(AAZCommand): - """Create a snapshot. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.creation_data = AAZObjectArg( - options=["--creation-data"], - arg_group="Properties", - help="Disk source information. CreationData information cannot be changed after the disk has been created.", - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["--disk-size-gb"], - arg_group="Properties", - help="If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.", - ) - _args_schema.encryption_settings = AAZObjectArg( - options=["--encryption-settings"], - arg_group="Properties", - help="Encryption settings for disk or snapshot", - ) - _args_schema.os_type = AAZStrArg( - options=["--os-type"], - arg_group="Properties", - help="The Operating System type.", - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - - creation_data = cls._args_schema.creation_data - creation_data.create_option = AAZStrArg( - options=["create-option"], - help="This enumerates the possible sources of a disk's creation.", - required=True, - enum={"Attach": "Attach", "Copy": "Copy", "Empty": "Empty", "FromImage": "FromImage", "Import": "Import"}, - ) - creation_data.image_reference = AAZObjectArg( - options=["image-reference"], - help="Disk source information for PIR or user images.", - ) - creation_data.source_resource_id = AAZStrArg( - options=["source-resource-id"], - help="If createOption is Copy, this is the ARM id of the source snapshot or disk.", - ) - creation_data.source_uri = AAZStrArg( - options=["source-uri"], - help="If createOption is Import, this is the URI of a blob to be imported into a managed disk.", - ) - creation_data.storage_account_id = AAZStrArg( - options=["storage-account-id"], - help="Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk.", - ) - - image_reference = cls._args_schema.creation_data.image_reference - image_reference.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository or user image reference.", - ) - image_reference.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - ) - - encryption_settings = cls._args_schema.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectArg( - options=["disk-encryption-key"], - help="Key Vault Secret Url and vault id of the disk encryption key", - ) - encryption_settings.enabled = AAZBoolArg( - options=["enabled"], - help="Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.", - ) - encryption_settings.key_encryption_key = AAZObjectArg( - options=["key-encryption-key"], - help="Key Vault Key Url and vault id of the key encryption key", - ) - - disk_encryption_key = cls._args_schema.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrArg( - options=["secret-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - disk_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(disk_encryption_key.source_vault) - - key_encryption_key = cls._args_schema.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrArg( - options=["key-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - key_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(key_encryption_key.source_vault) - - # define Arg Group "Snapshot" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Snapshot", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - arg_group="Snapshot", - help="The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot", - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Snapshot", - help="Resource tags", - ) - - sku = cls._args_schema.sku - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - _args_source_vault_create = None - - @classmethod - def _build_args_source_vault_create(cls, _schema): - if cls._args_source_vault_create is not None: - _schema.id = cls._args_source_vault_create.id - return - - cls._args_source_vault_create = AAZObjectArg() - - source_vault_create = cls._args_source_vault_create - source_vault_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_source_vault_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsCreateOrUpdate(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 SnapshotsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("creationData", AAZObjectType, ".creation_data", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryptionSettings", AAZObjectType, ".encryption_settings") - properties.set_prop("osType", AAZStrType, ".os_type") - - creation_data = _builder.get(".properties.creationData") - if creation_data is not None: - creation_data.set_prop("createOption", AAZStrType, ".create_option", typ_kwargs={"flags": {"required": True}}) - creation_data.set_prop("imageReference", AAZObjectType, ".image_reference") - creation_data.set_prop("sourceResourceId", AAZStrType, ".source_resource_id") - creation_data.set_prop("sourceUri", AAZStrType, ".source_uri") - creation_data.set_prop("storageAccountId", AAZStrType, ".storage_account_id") - - image_reference = _builder.get(".properties.creationData.imageReference") - if image_reference is not None: - image_reference.set_prop("id", AAZStrType, ".id") - image_reference.set_prop("lun", AAZIntType, ".lun") - - encryption_settings = _builder.get(".properties.encryptionSettings") - if encryption_settings is not None: - encryption_settings.set_prop("diskEncryptionKey", AAZObjectType, ".disk_encryption_key") - encryption_settings.set_prop("enabled", AAZBoolType, ".enabled") - encryption_settings.set_prop("keyEncryptionKey", AAZObjectType, ".key_encryption_key") - - disk_encryption_key = _builder.get(".properties.encryptionSettings.diskEncryptionKey") - if disk_encryption_key is not None: - disk_encryption_key.set_prop("secretUrl", AAZStrType, ".secret_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(disk_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - key_encryption_key = _builder.get(".properties.encryptionSettings.keyEncryptionKey") - if key_encryption_key is not None: - key_encryption_key.set_prop("keyUrl", AAZStrType, ".key_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(key_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".name") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - 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() - _CreateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_source_vault_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_snapshot_read = None - - @classmethod - def _build_schema_snapshot_read(cls, _schema): - if cls._schema_snapshot_read is not None: - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - return - - cls._schema_snapshot_read = _schema_snapshot_read = AAZObjectType() - - snapshot_read = _schema_snapshot_read - snapshot_read.id = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.location = AAZStrType( - flags={"required": True}, - ) - snapshot_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - snapshot_read.name = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - snapshot_read.sku = AAZObjectType() - snapshot_read.tags = AAZDictType() - snapshot_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_snapshot_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = _schema_snapshot_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = _schema_snapshot_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = _schema_snapshot_read.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_snapshot_read.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_snapshot_read.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_snapshot_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_snapshot_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_delete.py deleted file mode 100644 index 50651317a7c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_delete.py +++ /dev/null @@ -1,226 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot delete", -) -class Delete(AAZCommand): - """Delete a snapshot. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsDelete(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 SnapshotsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_grant_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_grant_access.py deleted file mode 100644 index 19c88fae2b1..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_grant_access.py +++ /dev/null @@ -1,231 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot grant-access", -) -class GrantAccess(AAZCommand): - """Grant read access to a snapshot. - - :example: Grant read access to a snapshot. - az snapshot grant-access --duration-in-seconds 3600 --name MySnapshot --resource-group MyResourceGroup - - :example: Grant read access to a snapshot with specifying the file format. - az snapshot grant-access --duration-in-seconds 3600 --name MySnapshot --resource-group MyResourceGroup --file-format VHDX - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}/begingetaccess", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - - # define Arg Group "GrantAccessData" - - _args_schema = cls._args_schema - _args_schema.access_level = AAZStrArg( - options=["--access", "--access-level"], - arg_group="GrantAccessData", - help="Access level.", - required=True, - default="Read", - enum={"Read": "Read"}, - ) - _args_schema.duration_in_seconds = AAZIntArg( - options=["--duration-in-seconds"], - arg_group="GrantAccessData", - help="Time duration in seconds until the SAS access expires.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsGrantAccess(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 SnapshotsGrantAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - 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("access", AAZStrType, ".access_level", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("durationInSeconds", AAZIntType, ".duration_in_seconds", 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.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties - properties.output = AAZObjectType( - flags={"client_flatten": True}, - ) - - output = cls._schema_on_200.properties.output - output.access_sas = AAZStrType( - serialized_name="accessSAS", - flags={"read_only": True}, - ) - - return cls._schema_on_200 - - -class _GrantAccessHelper: - """Helper class for GrantAccess""" - - -__all__ = ["GrantAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_list.py deleted file mode 100644 index 7ccd96c6b83..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_list.py +++ /dev/null @@ -1,486 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot list", -) -class List(AAZCommand): - """List snapshots under a resource group. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/snapshots", "2017-03-30"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.SnapshotsList(ctx=self.ctx)() - if condition_1: - self.SnapshotsListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class SnapshotsList(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.Compute/snapshots", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class SnapshotsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_revoke_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_revoke_access.py deleted file mode 100644 index fb0f81f3223..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_revoke_access.py +++ /dev/null @@ -1,215 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot revoke-access", -) -class RevokeAccess(AAZCommand): - """Revoke access to a snapshot. - - :example: Revoke read access to a snapshot. - az snapshot revoke-access --name MySnapshot --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}/endgetaccess", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsRevokeAccess(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 SnapshotsRevokeAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _RevokeAccessHelper: - """Helper class for RevokeAccess""" - - -__all__ = ["RevokeAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_show.py deleted file mode 100644 index 7396a19849e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_show.py +++ /dev/null @@ -1,282 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot show", -) -class Show(AAZCommand): - """Get information about a snapshot. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(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 SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_update.py deleted file mode 100644 index b12a78deb2d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_update.py +++ /dev/null @@ -1,505 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot update", -) -class Update(AAZCommand): - """Update a snapshot. - - :example: Update a snapshot and associate it with a disk access resource. - az snapshot update --name MySnapshot --resource-group MyResourceGroup --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Update a snapshot. - az snapshot update --name MySnapshot --resource-group MyResourceGroup --subscription MySubscription - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.sku = AAZStrArg( - options=["--sku"], - help="The sku name.", - nullable=True, - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - # define Arg Group "Properties" - - # define Arg Group "Snapshot" - return cls._args_schema - - _args_source_vault_update = None - - @classmethod - def _build_args_source_vault_update(cls, _schema): - if cls._args_source_vault_update is not None: - _schema.id = cls._args_source_vault_update.id - return - - cls._args_source_vault_update = AAZObjectArg() - - source_vault_update = cls._args_source_vault_update - source_vault_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_source_vault_update.id - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.SnapshotsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - class SnapshotsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType) - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".sku") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_source_vault_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_snapshot_read = None - - @classmethod - def _build_schema_snapshot_read(cls, _schema): - if cls._schema_snapshot_read is not None: - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - return - - cls._schema_snapshot_read = _schema_snapshot_read = AAZObjectType() - - snapshot_read = _schema_snapshot_read - snapshot_read.id = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.location = AAZStrType( - flags={"required": True}, - ) - snapshot_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - snapshot_read.name = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - snapshot_read.sku = AAZObjectType() - snapshot_read.tags = AAZDictType() - snapshot_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_snapshot_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = _schema_snapshot_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = _schema_snapshot_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = _schema_snapshot_read.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_snapshot_read.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_snapshot_read.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_snapshot_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_snapshot_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_wait.py deleted file mode 100644 index 9d380a32141..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/snapshot/_wait.py +++ /dev/null @@ -1,281 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(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=False) - return result - - class SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/__cmd_group.py deleted file mode 100644 index 9e6797e0f27..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm", -) -class __CMDGroup(AAZCommandGroup): - """Manage Linux or Windows virtual machines. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/__init__.py deleted file mode 100644 index 6063aac9daf..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._convert import * -from ._deallocate import * -from ._generalize import * -from ._list_sizes import * -from ._list_skus import * -from ._list_vm_resize_options import * -from ._perform_maintenance import * -from ._redeploy import * -from ._start import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_convert.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_convert.py deleted file mode 100644 index aa2e07b2d2a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_convert.py +++ /dev/null @@ -1,219 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm convert", -) -class Convert(AAZCommand): - """Convert a VM with unmanaged disks to use managed disks. - - :example: Convert a VM with unmanaged disks to use managed disks. - az vm convert -g MyResourceGroup -n MyVm - - :example: Convert all VMs with unmanaged disks in a resource group to use managed disks. - az vm convert --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/converttomanageddisks", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesConvertToManagedDisks(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 VirtualMachinesConvertToManagedDisks(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _ConvertHelper: - """Helper class for Convert""" - - -__all__ = ["Convert"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_deallocate.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_deallocate.py deleted file mode 100644 index e1dba58437b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_deallocate.py +++ /dev/null @@ -1,228 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm deallocate", -) -class Deallocate(AAZCommand): - """Deallocate a VM so that computing resources are no longer allocated (charges no longer apply). The status will change from 'Stopped' to 'Stopped (Deallocated)'. - - For an end-to-end tutorial, see https://learn.microsoft.com/azure/virtual-machines/linux/capture-image - - :example: Deallocate, generalize, and capture a stopped virtual machine. - az vm deallocate -g MyResourceGroup -n MyVm - az vm generalize -g MyResourceGroup -n MyVm - az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix - - :example: Deallocate, generalize, and capture multiple stopped virtual machines. - az vm deallocate --ids vms_ids - az vm generalize --ids vms_ids - az vm capture --ids vms_ids --vhd-name-prefix MyPrefix - - :example: Deallocate a VM. - az vm deallocate --name MyVm --no-wait --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/deallocate", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesDeallocate(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 VirtualMachinesDeallocate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _DeallocateHelper: - """Helper class for Deallocate""" - - -__all__ = ["Deallocate"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_generalize.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_generalize.py deleted file mode 100644 index e48267149cb..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_generalize.py +++ /dev/null @@ -1,208 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm generalize", -) -class Generalize(AAZCommand): - """Mark a VM as generalized, allowing it to be imaged for multiple deployments. - - For an end-to-end tutorial, see https://learn.microsoft.com/azure/virtual-machines/linux/capture-image - - :example: Deallocate, generalize, and capture a stopped virtual machine. - az vm deallocate -g MyResourceGroup -n MyVm - az vm generalize -g MyResourceGroup -n MyVm - az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix - - :example: Deallocate, generalize, and capture multiple stopped virtual machines. - az vm deallocate --ids vms_ids - az vm generalize --ids vms_ids - az vm capture --ids vms_ids --vhd-name-prefix MyPrefix - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/generalize", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachinesGeneralize(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 VirtualMachinesGeneralize(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _GeneralizeHelper: - """Helper class for Generalize""" - - -__all__ = ["Generalize"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_sizes.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_sizes.py deleted file mode 100644 index e060b78e015..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_sizes.py +++ /dev/null @@ -1,177 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-sizes", -) -class ListSizes(AAZCommand): - """List available sizes for VMs. - - :example: List the available VM sizes in the West US region. - az vm list-sizes -l westus - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/vmsizes", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineSizesList(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.value, client_flatten=True) - return result - - class VirtualMachineSizesList(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.Compute/locations/{location}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListSizesHelper: - """Helper class for ListSizes""" - - -__all__ = ["ListSizes"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_skus.py deleted file mode 100644 index 61042225cb3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_skus.py +++ /dev/null @@ -1,343 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-skus", -) -class ListSkus(AAZCommand): - """Get details for compute-related resource SKUs. - - This command incorporates subscription level restriction, offering the most accurate information. - """ - - _aaz_info = { - "version": "2019-04-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/skus", "2019-04-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply on the operation. Only **location** filter is supported currently.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ResourceSkusList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class ResourceSkusList(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.Compute/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "api-version", "2019-04-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.api_versions = AAZListType( - serialized_name="apiVersions", - flags={"read_only": True}, - ) - _element.capabilities = AAZListType( - flags={"read_only": True}, - ) - _element.capacity = AAZObjectType( - flags={"read_only": True}, - ) - _element.costs = AAZListType( - flags={"read_only": True}, - ) - _element.family = AAZStrType( - flags={"read_only": True}, - ) - _element.kind = AAZStrType( - flags={"read_only": True}, - ) - _element.location_info = AAZListType( - serialized_name="locationInfo", - flags={"read_only": True}, - ) - _element.locations = AAZListType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.resource_type = AAZStrType( - serialized_name="resourceType", - flags={"read_only": True}, - ) - _element.restrictions = AAZListType( - flags={"read_only": True}, - ) - _element.size = AAZStrType( - flags={"read_only": True}, - ) - _element.tier = AAZStrType( - flags={"read_only": True}, - ) - - api_versions = cls._schema_on_200.value.Element.api_versions - api_versions.Element = AAZStrType() - - capabilities = cls._schema_on_200.value.Element.capabilities - capabilities.Element = AAZObjectType() - _ListSkusHelper._build_schema_resource_sku_capabilities_read(capabilities.Element) - - capacity = cls._schema_on_200.value.Element.capacity - capacity.default = AAZIntType( - flags={"read_only": True}, - ) - capacity.maximum = AAZIntType( - flags={"read_only": True}, - ) - capacity.minimum = AAZIntType( - flags={"read_only": True}, - ) - capacity.scale_type = AAZStrType( - serialized_name="scaleType", - flags={"read_only": True}, - ) - - costs = cls._schema_on_200.value.Element.costs - costs.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.costs.Element - _element.extended_unit = AAZStrType( - serialized_name="extendedUnit", - flags={"read_only": True}, - ) - _element.meter_id = AAZStrType( - serialized_name="meterID", - flags={"read_only": True}, - ) - _element.quantity = AAZIntType( - flags={"read_only": True}, - ) - - location_info = cls._schema_on_200.value.Element.location_info - location_info.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.location_info.Element - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.zone_details = AAZListType( - serialized_name="zoneDetails", - flags={"read_only": True}, - ) - _element.zones = AAZListType( - flags={"read_only": True}, - ) - - zone_details = cls._schema_on_200.value.Element.location_info.Element.zone_details - zone_details.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element - _element.capabilities = AAZListType( - flags={"read_only": True}, - ) - _element.name = AAZListType( - flags={"read_only": True}, - ) - - capabilities = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element.capabilities - capabilities.Element = AAZObjectType() - _ListSkusHelper._build_schema_resource_sku_capabilities_read(capabilities.Element) - - name = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element.name - name.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.location_info.Element.zones - zones.Element = AAZStrType() - - locations = cls._schema_on_200.value.Element.locations - locations.Element = AAZStrType() - - restrictions = cls._schema_on_200.value.Element.restrictions - restrictions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.restrictions.Element - _element.reason_code = AAZStrType( - serialized_name="reasonCode", - flags={"read_only": True}, - ) - _element.restriction_info = AAZObjectType( - serialized_name="restrictionInfo", - flags={"read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.values = AAZListType( - flags={"read_only": True}, - ) - - restriction_info = cls._schema_on_200.value.Element.restrictions.Element.restriction_info - restriction_info.locations = AAZListType( - flags={"read_only": True}, - ) - restriction_info.zones = AAZListType( - flags={"read_only": True}, - ) - - locations = cls._schema_on_200.value.Element.restrictions.Element.restriction_info.locations - locations.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.restrictions.Element.restriction_info.zones - zones.Element = AAZStrType() - - values = cls._schema_on_200.value.Element.restrictions.Element.values - values.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - _schema_resource_sku_capabilities_read = None - - @classmethod - def _build_schema_resource_sku_capabilities_read(cls, _schema): - if cls._schema_resource_sku_capabilities_read is not None: - _schema.name = cls._schema_resource_sku_capabilities_read.name - _schema.value = cls._schema_resource_sku_capabilities_read.value - return - - cls._schema_resource_sku_capabilities_read = _schema_resource_sku_capabilities_read = AAZObjectType() - - resource_sku_capabilities_read = _schema_resource_sku_capabilities_read - resource_sku_capabilities_read.name = AAZStrType( - flags={"read_only": True}, - ) - resource_sku_capabilities_read.value = AAZStrType( - flags={"read_only": True}, - ) - - _schema.name = cls._schema_resource_sku_capabilities_read.name - _schema.value = cls._schema_resource_sku_capabilities_read.value - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_vm_resize_options.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_vm_resize_options.py deleted file mode 100644 index ec065a00725..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_list_vm_resize_options.py +++ /dev/null @@ -1,190 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-vm-resize-options", -) -class ListVmResizeOptions(AAZCommand): - """List available resizing options for VMs. - - :example: List all available VM sizes for resizing. - az vm list-vm-resize-options -g MyResourceGroup -n MyVm - - :example: List available sizes for all VMs in a resource group. - az vm list-vm-resize-options --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/vmsizes", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachinesListAvailableSizes(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.value, client_flatten=True) - return result - - class VirtualMachinesListAvailableSizes(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListVmResizeOptionsHelper: - """Helper class for ListVmResizeOptions""" - - -__all__ = ["ListVmResizeOptions"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_perform_maintenance.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_perform_maintenance.py deleted file mode 100644 index 151da689f30..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_perform_maintenance.py +++ /dev/null @@ -1,213 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm perform-maintenance", -) -class PerformMaintenance(AAZCommand): - """The operation to perform maintenance on a virtual machine. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/performmaintenance", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesPerformMaintenance(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 VirtualMachinesPerformMaintenance(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _PerformMaintenanceHelper: - """Helper class for PerformMaintenance""" - - -__all__ = ["PerformMaintenance"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_redeploy.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_redeploy.py deleted file mode 100644 index dff21dad49a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_redeploy.py +++ /dev/null @@ -1,219 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm redeploy", -) -class Redeploy(AAZCommand): - """Redeploy an existing VM. - - :example: Redeploy a VM. - az vm redeploy -g MyResourceGroup -n MyVm - - :example: Redeploy all VMs in a resource group. - az vm redeploy --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/redeploy", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesRedeploy(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 VirtualMachinesRedeploy(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _RedeployHelper: - """Helper class for Redeploy""" - - -__all__ = ["Redeploy"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_start.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_start.py deleted file mode 100644 index 2e3e991c740..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/_start.py +++ /dev/null @@ -1,222 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm start", -) -class Start(AAZCommand): - """Start a stopped VM. - - :example: Start a stopped VM. - az vm start -g MyResourceGroup -n MyVm - - :example: Start all VMs in a resource group. - az vm start --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - - :example: Start a stopped VM. - az vm start --name MyVm --no-wait --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/start", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesStart(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 VirtualMachinesStart(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _StartHelper: - """Helper class for Start""" - - -__all__ = ["Start"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/__cmd_group.py deleted file mode 100644 index 0311e45bc8c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/__cmd_group.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set", -) -class __CMDGroup(AAZCommandGroup): - """Group resources into availability sets. - - To provide redundancy to an application, it is recommended to group two or more virtual machines in an availability set. This configuration ensures that during either a planned or unplanned maintenance event, at least one virtual machine will be available. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/__init__.py deleted file mode 100644 index 8dd5aa6e8ed..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * -from ._list import * -from ._list_sizes import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_delete.py deleted file mode 100644 index 3688863c65c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_delete.py +++ /dev/null @@ -1,201 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set delete", -) -class Delete(AAZCommand): - """Delete an availability set. - - :example: Delete an availability set. - az vm availability-set delete -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2017-03-30"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class AvailabilitySetsDelete(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) - if session.http_response.status_code in [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_list.py deleted file mode 100644 index 08727b51dda..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_list.py +++ /dev/null @@ -1,376 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set list", -) -class List(AAZCommand): - """List all availability sets in a subscription. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/availabilitysets", "2017-03-30"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply to the operation. Allowed values are 'virtualMachines/$ref'.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.AvailabilitySetsListBySubscription(ctx=self.ctx)() - if condition_1: - self.AvailabilitySetsList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class AvailabilitySetsListBySubscription(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.Compute/availabilitySets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.value.Element.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machines.Element - _element.id = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class AvailabilitySetsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.value.Element.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machines.Element - _element.id = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_list_sizes.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_list_sizes.py deleted file mode 100644 index 36afde085ff..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_list_sizes.py +++ /dev/null @@ -1,186 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set list-sizes", -) -class ListSizes(AAZCommand): - """List all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. - - :example: List VM sizes for an availability set. - az vm availability-set list-sizes -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}/vmsizes", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsListAvailableSizes(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.value, client_flatten=True) - return result - - class AvailabilitySetsListAvailableSizes(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListSizesHelper: - """Helper class for ListSizes""" - - -__all__ = ["ListSizes"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_show.py deleted file mode 100644 index 215ffc909b7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_show.py +++ /dev/null @@ -1,221 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set show", -) -class Show(AAZCommand): - """Get information about an availability set. - - :example: Get information about an availability set. - az vm availability-set show -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(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 AvailabilitySetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.virtual_machines.Element - _element.id = AAZStrType() - - sku = cls._schema_on_200.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_update.py deleted file mode 100644 index 6fe9a14000d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/availability_set/_update.py +++ /dev/null @@ -1,425 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set update", -) -class Update(AAZCommand): - """Update an Azure Availability Set. - - :example: Update an availability set - az vm availability-set update -n MyAvSet -g MyResourceGroup - - :example: Update an availability set tag. - az vm availability-set update -n MyAvSet -g MyResourceGroup --set tags.foo=value - - :example: Remove an availability set tag. - az vm availability-set update -n MyAvSet -g MyResourceGroup --remove tags.foo - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_GENERIC_UPDATE = True - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.platform_fault_domain_count = AAZIntArg( - options=["--platform-fault-domain-count"], - help="Fault Domain count.", - nullable=True, - ) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - help="Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'.", - nullable=True, - ) - - sku = cls._args_schema.sku - sku.capacity = AAZIntArg( - options=["capacity"], - help="Specifies the number of virtual machines in the scale set.", - nullable=True, - ) - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - nullable=True, - ) - sku.tier = AAZStrArg( - options=["tier"], - help="Specifies the tier of virtual machines in a scale set.

Possible Values:

**Standard**

**Basic**", - nullable=True, - ) - - # define Arg Group "Properties" - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.AvailabilitySetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class AvailabilitySetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_availability_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - class AvailabilitySetsCreateOrUpdate(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_availability_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("platformFaultDomainCount", AAZIntType, ".platform_fault_domain_count") - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("capacity", AAZIntType, ".capacity") - sku.set_prop("name", AAZStrType, ".name") - sku.set_prop("tier", AAZStrType, ".tier") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - _schema_availability_set_read = None - - @classmethod - def _build_schema_availability_set_read(cls, _schema): - if cls._schema_availability_set_read is not None: - _schema.id = cls._schema_availability_set_read.id - _schema.location = cls._schema_availability_set_read.location - _schema.name = cls._schema_availability_set_read.name - _schema.properties = cls._schema_availability_set_read.properties - _schema.sku = cls._schema_availability_set_read.sku - _schema.tags = cls._schema_availability_set_read.tags - _schema.type = cls._schema_availability_set_read.type - return - - cls._schema_availability_set_read = _schema_availability_set_read = AAZObjectType() - - availability_set_read = _schema_availability_set_read - availability_set_read.id = AAZStrType( - flags={"read_only": True}, - ) - availability_set_read.location = AAZStrType( - flags={"required": True}, - ) - availability_set_read.name = AAZStrType( - flags={"read_only": True}, - ) - availability_set_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - availability_set_read.sku = AAZObjectType() - availability_set_read.tags = AAZDictType() - availability_set_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_availability_set_read.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = _schema_availability_set_read.properties.statuses - statuses.Element = AAZObjectType() - - _element = _schema_availability_set_read.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = _schema_availability_set_read.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = _schema_availability_set_read.properties.virtual_machines.Element - _element.id = AAZStrType() - - sku = _schema_availability_set_read.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = _schema_availability_set_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_availability_set_read.id - _schema.location = cls._schema_availability_set_read.location - _schema.name = cls._schema_availability_set_read.name - _schema.properties = cls._schema_availability_set_read.properties - _schema.sku = cls._schema_availability_set_read.sku - _schema.tags = cls._schema_availability_set_read.tags - _schema.type = cls._schema_availability_set_read.type - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/__cmd_group.py deleted file mode 100644 index 5951a534238..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/__cmd_group.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension", -) -class __CMDGroup(AAZCommandGroup): - """Manage extensions on VMs. - - Extensions are small applications that provide post-deployment configuration and automation tasks on Azure virtual machines. For example, if a virtual machine requires software installation, anti-virus protection, or Docker configuration, a VM extension can be used to complete these tasks. Extensions can be bundled with a new virtual machine deployment or run against any existing system. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/__init__.py deleted file mode 100644 index af9cedd3228..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/_delete.py deleted file mode 100644 index 03e60199513..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/_delete.py +++ /dev/null @@ -1,240 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension delete", -) -class Delete(AAZCommand): - """Delete operation to delete the extension. - - :example: Use a VM name and extension to delete an extension from a VM. - az vm extension delete -g MyResourceGroup --vm-name MyVm -n MyExtensionName - - :example: Delete extensions with IDs containing the string "MyExtension" from a VM. - az vm extension delete --ids $(az resource list --query "[?contains(name, 'MyExtension')].id" -o tsv) - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/extensions/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_extension_name = AAZStrArg( - options=["-n", "--name", "--vm-extension-name"], - help="The name of the virtual machine extension.", - required=True, - id_part="child_name_1", - ) - _args_schema.vm_name = AAZStrArg( - options=["--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineExtensionsDelete(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 VirtualMachineExtensionsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmExtensionName", self.ctx.args.vm_extension_name, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/__cmd_group.py deleted file mode 100644 index 98e25e5aa1d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image", -) -class __CMDGroup(AAZCommandGroup): - """Find the available VM extensions for a subscription and region. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/__init__.py deleted file mode 100644 index 4b2012758a6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list_names import * -from ._list_versions import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_list_names.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_list_names.py deleted file mode 100644 index c6e6a3ab0aa..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_list_names.py +++ /dev/null @@ -1,211 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image list-names", -) -class ListNames(AAZCommand): - """List the names of available extensions. - - :example: Find Docker extensions by publisher and location. - az vm extension image list-names --publisher Microsoft.Azure.Extensions -l westus --query "[?starts_with(name, 'Docker')]" - - :example: Find CustomScript extensions by publisher and location. - az vm extension image list-names --publisher Microsoft.Azure.Extensions -l westus --query "[?starts_with(name, 'Custom')]" - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesListTypes(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 VirtualMachineExtensionImagesListTypes(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **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", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.Element.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListNamesHelper: - """Helper class for ListNames""" - - -__all__ = ["ListNames"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_list_versions.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_list_versions.py deleted file mode 100644 index d21c05c12c8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_list_versions.py +++ /dev/null @@ -1,239 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image list-versions", -) -class ListVersions(AAZCommand): - """List the versions for available extensions. - - :example: Find the available versions for the Docker extension. - az vm extension image list-versions --publisher Microsoft.Azure.Extensions -l westus -n DockerExtension -o table - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types/{}/versions", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name", "--type"], - help="Name of the extension.", - required=True, - id_part="child_name_3", - ) - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply on the operation. Default value is None.", - ) - _args_schema.orderby = AAZStrArg( - options=["--orderby"], - help="The $orderby odata query option.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="The $top odata query option.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesListVersions(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 VirtualMachineExtensionImagesListVersions(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "type", self.ctx.args.name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "$orderby", self.ctx.args.orderby, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.Element.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListVersionsHelper: - """Helper class for ListVersions""" - - -__all__ = ["ListVersions"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_show.py deleted file mode 100644 index 4273ae26c3a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/extension/image/_show.py +++ /dev/null @@ -1,229 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image show", -) -class Show(AAZCommand): - """Display information for an extension. - - :example: Show the CustomScript extension version 2.0.2. - az vm extension image show -l westus -n CustomScript --publisher Microsoft.Azure.Extensions --version 2.0.2 - - :example: Show the latest version of the Docker extension. - az vm extension image list-versions --publisher Microsoft.Azure.Extensions -l westus -n DockerExtension --query "[].name" -o tsv | sort | tail -n 1 - az vm extension image show -l westus --publisher Microsoft.Azure.Extensions -n DockerExtension --version LatestVersion - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types/{}/versions/{}", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name", "--type"], - help="Name of the extension.", - required=True, - id_part="child_name_3", - ) - _args_schema.version = AAZStrArg( - options=["--version"], - help="Extension version.", - required=True, - id_part="child_name_4", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesGet(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 VirtualMachineExtensionImagesGet(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "type", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "version", self.ctx.args.version, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/__cmd_group.py deleted file mode 100644 index b78c1878632..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image", -) -class __CMDGroup(AAZCommandGroup): - """Information on available virtual machine images. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/__init__.py deleted file mode 100644 index 069febe7e47..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._list_offers import * -from ._list_publishers import * -from ._list_skus import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list.py deleted file mode 100644 index 41a47fb1d0d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list.py +++ /dev/null @@ -1,243 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - ) - _args_schema.sku = AAZStrArg( - options=["-s", "--sku"], - help="A valid image SKU.", - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - _args_schema.orderby = AAZStrArg( - options=["--orderby"], - ) - _args_schema.top = AAZIntArg( - options=["--top"], - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesList(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 VirtualMachineImagesList(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **self.serialize_url_param( - "skus", self.ctx.args.sku, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "$orderby", self.ctx.args.orderby, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_offers.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_offers.py deleted file mode 100644 index ced13c98292..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_offers.py +++ /dev/null @@ -1,217 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-offers", -) -class ListOffers(AAZCommand): - """List a list of virtual machine image offers for the specified location and publisher. - - :example: List all offers from Microsoft in the West US region. - az vm image list-offers -l westus -p MicrosoftWindowsServer - - :example: List all offers from OpenLocic in the West US region. - az vm image list-offers -l westus -p OpenLogic - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListOffers(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 VirtualMachineImagesListOffers(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListOffersHelper: - """Helper class for ListOffers""" - - -__all__ = ["ListOffers"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_publishers.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_publishers.py deleted file mode 100644 index f9e7ef51258..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_publishers.py +++ /dev/null @@ -1,207 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-publishers", -) -class ListPublishers(AAZCommand): - """List a list of virtual machine image publishers for the specified Azure location. - - :example: List all publishers in the West US region. - az vm image list-publishers -l westus - - :example: List all publishers with names starting with "Open" in westus. - az vm image list-publishers -l westus --query "[?starts_with(name, 'Open')]" - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListPublishers(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 VirtualMachineImagesListPublishers(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.Compute/locations/{location}/publishers", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListPublishersHelper: - """Helper class for ListPublishers""" - - -__all__ = ["ListPublishers"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_skus.py deleted file mode 100644 index 82595bedd10..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_list_skus.py +++ /dev/null @@ -1,224 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-skus", -) -class ListSkus(AAZCommand): - """List a list of virtual machine image SKUs for the specified location, publisher, and offer. - - :example: List all skus available for CentOS published by OpenLogic in the West US region. - az vm image list-skus -l westus -f CentOS -p OpenLogic - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - id_part="child_name_3", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListSkus(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 VirtualMachineImagesListSkus(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_show.py deleted file mode 100644 index 159a06b63df..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vm/image/_show.py +++ /dev/null @@ -1,243 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get a virtual machine image. - - :example: Get the details for a VM image available in the Azure Marketplace. - az vm image show --location westus --urn publisher:offer:sku:version - - :example: Show information for the latest available CentOS image from OpenLogic. - az vm image show -l westus -f CentOS -p OpenLogic --sku 7.3 --version $(az vm image list -p OpenLogic -s 7.3 --all --query "[?offer=='CentOS'].version" -o tsv | sort -u | tail -n 1) - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - id_part="child_name_3", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - _args_schema.sku = AAZStrArg( - options=["-s", "--sku"], - help="A valid image SKU.", - required=True, - id_part="child_name_4", - ) - _args_schema.version = AAZStrArg( - options=["--version"], - help="A valid image SKU version.", - required=True, - id_part="child_name_5", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesGet(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 VirtualMachineImagesGet(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **self.serialize_url_param( - "skus", self.ctx.args.sku, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "version", self.ctx.args.version, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType() - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - - properties = cls._schema_on_200.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/__cmd_group.py deleted file mode 100644 index c3779a0d2d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss", -) -class __CMDGroup(AAZCommandGroup): - """Manage groupings of virtual machines in an Azure Virtual Machine Scale Set (VMSS). - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/__init__.py deleted file mode 100644 index 09bcd5ec673..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * -from ._list import * -from ._list_instance_public_ips import * -from ._list_instances import * -from ._list_skus import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_delete.py deleted file mode 100644 index 51cf19256d9..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_delete.py +++ /dev/null @@ -1,224 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss delete", -) -class Delete(AAZCommand): - """Delete a VM scale set. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetsDelete(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 VirtualMachineScaleSetsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list.py deleted file mode 100644 index 56655d9ca36..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list.py +++ /dev/null @@ -1,1185 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list", -) -class List(AAZCommand): - """List all VM scale sets under a resource group. - - :example: List VMSS - az vmss list --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/virtualmachinescalesets", "2017-03-30"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.VirtualMachineScaleSetsListAll(ctx=self.ctx)() - if condition_1: - self.VirtualMachineScaleSetsList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetsListAll(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.Compute/virtualMachineScaleSets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.identity = AAZObjectType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - identity = cls._schema_on_200.value.Element.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.overprovision = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.single_placement_group = AAZBoolType( - serialized_name="singlePlacementGroup", - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - properties.upgrade_policy = AAZObjectType( - serialized_name="upgradePolicy", - ) - properties.virtual_machine_profile = AAZObjectType( - serialized_name="virtualMachineProfile", - ) - - upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy - upgrade_policy.automatic_os_upgrade = AAZBoolType( - serialized_name="automaticOSUpgrade", - ) - upgrade_policy.mode = AAZStrType() - upgrade_policy.rolling_upgrade_policy = AAZObjectType( - serialized_name="rollingUpgradePolicy", - ) - - rolling_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.rolling_upgrade_policy - rolling_upgrade_policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - rolling_upgrade_policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - - virtual_machine_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile - virtual_machine_profile.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - virtual_machine_profile.extension_profile = AAZObjectType( - serialized_name="extensionProfile", - ) - virtual_machine_profile.license_type = AAZStrType( - serialized_name="licenseType", - ) - virtual_machine_profile.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - virtual_machine_profile.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - virtual_machine_profile.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - extension_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile - extension_profile.extensions = AAZListType() - - extensions = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions - extensions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - network_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile - network_profile.health_probe = AAZObjectType( - serialized_name="healthProbe", - ) - _ListHelper._build_schema_api_entity_reference_read(network_profile.health_probe) - network_profile.network_interface_configurations = AAZListType( - serialized_name="networkInterfaceConfigurations", - ) - - network_interface_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations - network_interface_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"required": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.network_security_group) - properties.primary = AAZBoolType() - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_pools = AAZListType( - serialized_name="loadBalancerInboundNatPools", - ) - properties.primary = AAZBoolType() - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.public_ip_address_configuration = AAZObjectType( - serialized_name="publicIPAddressConfiguration", - ) - properties.subnet = AAZObjectType() - _ListHelper._build_schema_api_entity_reference_read(properties.subnet) - - application_gateway_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(application_gateway_backend_address_pools.Element) - - load_balancer_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_inbound_nat_pools - load_balancer_inbound_nat_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_inbound_nat_pools.Element) - - public_ip_address_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration - public_ip_address_configuration.name = AAZStrType( - flags={"required": True}, - ) - public_ip_address_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - flags={"required": True}, - ) - - os_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.computer_name_prefix = AAZStrType( - serialized_name="computerNamePrefix", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - win_rm = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - storage_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - - image_reference = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.image_reference - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.image = AAZObjectType() - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd_containers = AAZListType( - serialized_name="vhdContainers", - ) - - image = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.image - image.uri = AAZStrType() - - vhd_containers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.vhd_containers - vhd_containers.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class VirtualMachineScaleSetsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.identity = AAZObjectType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - identity = cls._schema_on_200.value.Element.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.overprovision = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.single_placement_group = AAZBoolType( - serialized_name="singlePlacementGroup", - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - properties.upgrade_policy = AAZObjectType( - serialized_name="upgradePolicy", - ) - properties.virtual_machine_profile = AAZObjectType( - serialized_name="virtualMachineProfile", - ) - - upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy - upgrade_policy.automatic_os_upgrade = AAZBoolType( - serialized_name="automaticOSUpgrade", - ) - upgrade_policy.mode = AAZStrType() - upgrade_policy.rolling_upgrade_policy = AAZObjectType( - serialized_name="rollingUpgradePolicy", - ) - - rolling_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.rolling_upgrade_policy - rolling_upgrade_policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - rolling_upgrade_policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - - virtual_machine_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile - virtual_machine_profile.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - virtual_machine_profile.extension_profile = AAZObjectType( - serialized_name="extensionProfile", - ) - virtual_machine_profile.license_type = AAZStrType( - serialized_name="licenseType", - ) - virtual_machine_profile.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - virtual_machine_profile.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - virtual_machine_profile.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - extension_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile - extension_profile.extensions = AAZListType() - - extensions = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions - extensions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - network_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile - network_profile.health_probe = AAZObjectType( - serialized_name="healthProbe", - ) - _ListHelper._build_schema_api_entity_reference_read(network_profile.health_probe) - network_profile.network_interface_configurations = AAZListType( - serialized_name="networkInterfaceConfigurations", - ) - - network_interface_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations - network_interface_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"required": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.network_security_group) - properties.primary = AAZBoolType() - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_pools = AAZListType( - serialized_name="loadBalancerInboundNatPools", - ) - properties.primary = AAZBoolType() - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.public_ip_address_configuration = AAZObjectType( - serialized_name="publicIPAddressConfiguration", - ) - properties.subnet = AAZObjectType() - _ListHelper._build_schema_api_entity_reference_read(properties.subnet) - - application_gateway_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(application_gateway_backend_address_pools.Element) - - load_balancer_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_inbound_nat_pools - load_balancer_inbound_nat_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_inbound_nat_pools.Element) - - public_ip_address_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration - public_ip_address_configuration.name = AAZStrType( - flags={"required": True}, - ) - public_ip_address_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - flags={"required": True}, - ) - - os_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.computer_name_prefix = AAZStrType( - serialized_name="computerNamePrefix", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - win_rm = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - storage_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - - image_reference = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.image_reference - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.image = AAZObjectType() - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd_containers = AAZListType( - serialized_name="vhdContainers", - ) - - image = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.image - image.uri = AAZStrType() - - vhd_containers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.vhd_containers - vhd_containers.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_api_entity_reference_read = None - - @classmethod - def _build_schema_api_entity_reference_read(cls, _schema): - if cls._schema_api_entity_reference_read is not None: - _schema.id = cls._schema_api_entity_reference_read.id - return - - cls._schema_api_entity_reference_read = _schema_api_entity_reference_read = AAZObjectType() - - api_entity_reference_read = _schema_api_entity_reference_read - api_entity_reference_read.id = AAZStrType() - - _schema.id = cls._schema_api_entity_reference_read.id - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_virtual_machine_scale_set_managed_disk_parameters_read = None - - @classmethod - def _build_schema_virtual_machine_scale_set_managed_disk_parameters_read(cls, _schema): - if cls._schema_virtual_machine_scale_set_managed_disk_parameters_read is not None: - _schema.storage_account_type = cls._schema_virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type - return - - cls._schema_virtual_machine_scale_set_managed_disk_parameters_read = _schema_virtual_machine_scale_set_managed_disk_parameters_read = AAZObjectType() - - virtual_machine_scale_set_managed_disk_parameters_read = _schema_virtual_machine_scale_set_managed_disk_parameters_read - virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - _schema.storage_account_type = cls._schema_virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_instance_public_ips.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_instance_public_ips.py deleted file mode 100644 index abba94d5900..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_instance_public_ips.py +++ /dev/null @@ -1,1535 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class ListInstancePublicIps(AAZCommand): - """List information about all public IP addresses on a virtual machine scale set level. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/publicipaddresses", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vmss_name = AAZStrArg( - options=["--vmss-name"], - help="The name of the virtual machine scale set.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PublicIPAddressesListVirtualMachineScaleSetPublicIPAddresses(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class PublicIPAddressesListVirtualMachineScaleSetPublicIPAddresses(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.vmss_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListInstancePublicIpsHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - -class _ListInstancePublicIpsHelper: - """Helper class for ListInstancePublicIps""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - cls._build_schema_private_endpoint_read(properties.private_endpoint) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_private_endpoint_read = None - - @classmethod - def _build_schema_private_endpoint_read(cls, _schema): - if cls._schema_private_endpoint_read is not None: - _schema.etag = cls._schema_private_endpoint_read.etag - _schema.id = cls._schema_private_endpoint_read.id - _schema.location = cls._schema_private_endpoint_read.location - _schema.name = cls._schema_private_endpoint_read.name - _schema.properties = cls._schema_private_endpoint_read.properties - _schema.tags = cls._schema_private_endpoint_read.tags - _schema.type = cls._schema_private_endpoint_read.type - return - - cls._schema_private_endpoint_read = _schema_private_endpoint_read = AAZObjectType() - - private_endpoint_read = _schema_private_endpoint_read - private_endpoint_read.etag = AAZStrType() - private_endpoint_read.id = AAZStrType() - private_endpoint_read.location = AAZStrType() - private_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - private_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - private_endpoint_read.tags = AAZDictType() - private_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_private_endpoint_read.properties - properties.manual_private_link_service_connections = AAZListType( - serialized_name="manualPrivateLinkServiceConnections", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.private_link_service_connections = AAZListType( - serialized_name="privateLinkServiceConnections", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - manual_private_link_service_connections = _schema_private_endpoint_read.properties.manual_private_link_service_connections - manual_private_link_service_connections.Element = AAZObjectType() - cls._build_schema_private_link_service_connection_read(manual_private_link_service_connections.Element) - - network_interfaces = _schema_private_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - private_link_service_connections = _schema_private_endpoint_read.properties.private_link_service_connections - private_link_service_connections.Element = AAZObjectType() - cls._build_schema_private_link_service_connection_read(private_link_service_connections.Element) - - tags = _schema_private_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_private_endpoint_read.etag - _schema.id = cls._schema_private_endpoint_read.id - _schema.location = cls._schema_private_endpoint_read.location - _schema.name = cls._schema_private_endpoint_read.name - _schema.properties = cls._schema_private_endpoint_read.properties - _schema.tags = cls._schema_private_endpoint_read.tags - _schema.type = cls._schema_private_endpoint_read.type - - _schema_private_link_service_connection_read = None - - @classmethod - def _build_schema_private_link_service_connection_read(cls, _schema): - if cls._schema_private_link_service_connection_read is not None: - _schema.etag = cls._schema_private_link_service_connection_read.etag - _schema.id = cls._schema_private_link_service_connection_read.id - _schema.name = cls._schema_private_link_service_connection_read.name - _schema.properties = cls._schema_private_link_service_connection_read.properties - _schema.type = cls._schema_private_link_service_connection_read.type - return - - cls._schema_private_link_service_connection_read = _schema_private_link_service_connection_read = AAZObjectType() - - private_link_service_connection_read = _schema_private_link_service_connection_read - private_link_service_connection_read.etag = AAZStrType( - flags={"read_only": True}, - ) - private_link_service_connection_read.id = AAZStrType() - private_link_service_connection_read.name = AAZStrType() - private_link_service_connection_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - private_link_service_connection_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_private_link_service_connection_read.properties - properties.group_ids = AAZListType( - serialized_name="groupIds", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - ) - properties.private_link_service_id = AAZStrType( - serialized_name="privateLinkServiceId", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.request_message = AAZStrType( - serialized_name="requestMessage", - ) - - group_ids = _schema_private_link_service_connection_read.properties.group_ids - group_ids.Element = AAZStrType() - - private_link_service_connection_state = _schema_private_link_service_connection_read.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - _schema.etag = cls._schema_private_link_service_connection_read.etag - _schema.id = cls._schema_private_link_service_connection_read.id - _schema.name = cls._schema_private_link_service_connection_read.name - _schema.properties = cls._schema_private_link_service_connection_read.properties - _schema.type = cls._schema_private_link_service_connection_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.nat_gateway = AAZObjectType( - serialized_name="natGateway", - ) - cls._build_schema_sub_resource_read(properties.nat_gateway) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.private_endpoint_network_policies = AAZStrType( - serialized_name="privateEndpointNetworkPolicies", - ) - properties.private_endpoints = AAZListType( - serialized_name="privateEndpoints", - flags={"read_only": True}, - ) - properties.private_link_service_network_policies = AAZStrType( - serialized_name="privateLinkServiceNetworkPolicies", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - private_endpoints = _schema_subnet_read.properties.private_endpoints - private_endpoints.Element = AAZObjectType() - cls._build_schema_private_endpoint_read(private_endpoints.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.allow_delete = AAZBoolType( - serialized_name="allowDelete", - ) - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.locations = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - locations = _schema_subnet_read.properties.service_association_links.Element.properties.locations - locations.Element = AAZStrType() - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.type = AAZStrType( - flags={"read_only": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["ListInstancePublicIps"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_instances.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_instances.py deleted file mode 100644 index d3c2ff504ba..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_instances.py +++ /dev/null @@ -1,784 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list-instances", -) -class ListInstances(AAZCommand): - """List all virtual machines in a VM scale sets. - - Return a list of virtual machines managed by VMSS. For VMSS in Flexible Orchestration mode, please use "az vm list" to get full details. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--virtual-machine-scale-set-name"], - help="The name of the VM scale set.", - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply to the operation. Allowed values are 'instanceView'.", - ) - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.", - ) - _args_schema.select = AAZStrArg( - options=["--select"], - help="The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetVMsList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetVMsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "$select", self.ctx.args.select, - ), - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.instance_id = AAZStrType( - serialized_name="instanceId", - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.resources = AAZListType( - flags={"read_only": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.availability_set = AAZObjectType( - serialized_name="availabilitySet", - ) - _ListInstancesHelper._build_schema_sub_resource_read(properties.availability_set) - properties.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - properties.hardware_profile = AAZObjectType( - serialized_name="hardwareProfile", - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - properties.latest_model_applied = AAZBoolType( - serialized_name="latestModelApplied", - flags={"read_only": True}, - ) - properties.license_type = AAZStrType( - serialized_name="licenseType", - ) - properties.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - properties.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - properties.vm_id = AAZStrType( - serialized_name="vmId", - flags={"read_only": True}, - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - hardware_profile = cls._schema_on_200.value.Element.properties.hardware_profile - hardware_profile.vm_size = AAZStrType( - serialized_name="vmSize", - ) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - instance_view.disks = AAZListType() - instance_view.extensions = AAZListType() - instance_view.placement_group_id = AAZStrType( - serialized_name="placementGroupId", - ) - instance_view.platform_fault_domain = AAZIntType( - serialized_name="platformFaultDomain", - ) - instance_view.platform_update_domain = AAZIntType( - serialized_name="platformUpdateDomain", - ) - instance_view.rdp_thumb_print = AAZStrType( - serialized_name="rdpThumbPrint", - ) - instance_view.statuses = AAZListType() - instance_view.vm_agent = AAZObjectType( - serialized_name="vmAgent", - ) - instance_view.vm_health = AAZObjectType( - serialized_name="vmHealth", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.instance_view.boot_diagnostics - boot_diagnostics.console_screenshot_blob_uri = AAZStrType( - serialized_name="consoleScreenshotBlobUri", - flags={"read_only": True}, - ) - boot_diagnostics.serial_console_log_blob_uri = AAZStrType( - serialized_name="serialConsoleLogBlobUri", - flags={"read_only": True}, - ) - - disks = cls._schema_on_200.value.Element.properties.instance_view.disks - disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.disks.Element - _element.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - _element.name = AAZStrType() - _element.statuses = AAZListType() - - encryption_settings = cls._schema_on_200.value.Element.properties.instance_view.disks.Element.encryption_settings - encryption_settings.Element = AAZObjectType() - _ListInstancesHelper._build_schema_disk_encryption_settings_read(encryption_settings.Element) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.disks.Element.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - extensions = cls._schema_on_200.value.Element.properties.instance_view.extensions - extensions.Element = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_machine_extension_instance_view_read(extensions.Element) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - vm_agent = cls._schema_on_200.value.Element.properties.instance_view.vm_agent - vm_agent.extension_handlers = AAZListType( - serialized_name="extensionHandlers", - ) - vm_agent.statuses = AAZListType() - vm_agent.vm_agent_version = AAZStrType( - serialized_name="vmAgentVersion", - ) - - extension_handlers = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.extension_handlers - extension_handlers.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.extension_handlers.Element - _element.status = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(_element.status) - _element.type = AAZStrType() - _element.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - vm_health = cls._schema_on_200.value.Element.properties.instance_view.vm_health - vm_health.status = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(vm_health.status) - - network_profile = cls._schema_on_200.value.Element.properties.network_profile - network_profile.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - - network_interfaces = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces.Element - _element.id = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces.Element.properties - properties.primary = AAZBoolType() - - os_profile = cls._schema_on_200.value.Element.properties.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.computer_name = AAZStrType( - serialized_name="computerName", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListInstancesHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - win_rm = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.image = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(_element.image) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListInstancesHelper._build_schema_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - _element.vhd = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(_element.vhd) - - image_reference = cls._schema_on_200.value.Element.properties.storage_profile.image_reference - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - _ListInstancesHelper._build_schema_disk_encryption_settings_read(os_disk.encryption_settings) - os_disk.image = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(os_disk.image) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListInstancesHelper._build_schema_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(os_disk.vhd) - - resources = cls._schema_on_200.value.Element.resources - resources.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.resources.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.resources.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - _ListInstancesHelper._build_schema_virtual_machine_extension_instance_view_read(properties.instance_view) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - tags = cls._schema_on_200.value.Element.resources.Element.tags - tags.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListInstancesHelper: - """Helper class for ListInstances""" - - _schema_disk_encryption_settings_read = None - - @classmethod - def _build_schema_disk_encryption_settings_read(cls, _schema): - if cls._schema_disk_encryption_settings_read is not None: - _schema.disk_encryption_key = cls._schema_disk_encryption_settings_read.disk_encryption_key - _schema.enabled = cls._schema_disk_encryption_settings_read.enabled - _schema.key_encryption_key = cls._schema_disk_encryption_settings_read.key_encryption_key - return - - cls._schema_disk_encryption_settings_read = _schema_disk_encryption_settings_read = AAZObjectType() - - disk_encryption_settings_read = _schema_disk_encryption_settings_read - disk_encryption_settings_read.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - disk_encryption_settings_read.enabled = AAZBoolType() - disk_encryption_settings_read.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_encryption_settings_read.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_sub_resource_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_encryption_settings_read.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_sub_resource_read(key_encryption_key.source_vault) - - _schema.disk_encryption_key = cls._schema_disk_encryption_settings_read.disk_encryption_key - _schema.enabled = cls._schema_disk_encryption_settings_read.enabled - _schema.key_encryption_key = cls._schema_disk_encryption_settings_read.key_encryption_key - - _schema_instance_view_status_read = None - - @classmethod - def _build_schema_instance_view_status_read(cls, _schema): - if cls._schema_instance_view_status_read is not None: - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - return - - cls._schema_instance_view_status_read = _schema_instance_view_status_read = AAZObjectType() - - instance_view_status_read = _schema_instance_view_status_read - instance_view_status_read.code = AAZStrType() - instance_view_status_read.display_status = AAZStrType( - serialized_name="displayStatus", - ) - instance_view_status_read.level = AAZStrType() - instance_view_status_read.message = AAZStrType() - instance_view_status_read.time = AAZStrType() - - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - - _schema_managed_disk_parameters_read = None - - @classmethod - def _build_schema_managed_disk_parameters_read(cls, _schema): - if cls._schema_managed_disk_parameters_read is not None: - _schema.id = cls._schema_managed_disk_parameters_read.id - _schema.storage_account_type = cls._schema_managed_disk_parameters_read.storage_account_type - return - - cls._schema_managed_disk_parameters_read = _schema_managed_disk_parameters_read = AAZObjectType() - - managed_disk_parameters_read = _schema_managed_disk_parameters_read - managed_disk_parameters_read.id = AAZStrType() - managed_disk_parameters_read.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - _schema.id = cls._schema_managed_disk_parameters_read.id - _schema.storage_account_type = cls._schema_managed_disk_parameters_read.storage_account_type - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_virtual_hard_disk_read = None - - @classmethod - def _build_schema_virtual_hard_disk_read(cls, _schema): - if cls._schema_virtual_hard_disk_read is not None: - _schema.uri = cls._schema_virtual_hard_disk_read.uri - return - - cls._schema_virtual_hard_disk_read = _schema_virtual_hard_disk_read = AAZObjectType() - - virtual_hard_disk_read = _schema_virtual_hard_disk_read - virtual_hard_disk_read.uri = AAZStrType() - - _schema.uri = cls._schema_virtual_hard_disk_read.uri - - _schema_virtual_machine_extension_instance_view_read = None - - @classmethod - def _build_schema_virtual_machine_extension_instance_view_read(cls, _schema): - if cls._schema_virtual_machine_extension_instance_view_read is not None: - _schema.name = cls._schema_virtual_machine_extension_instance_view_read.name - _schema.statuses = cls._schema_virtual_machine_extension_instance_view_read.statuses - _schema.substatuses = cls._schema_virtual_machine_extension_instance_view_read.substatuses - _schema.type = cls._schema_virtual_machine_extension_instance_view_read.type - _schema.type_handler_version = cls._schema_virtual_machine_extension_instance_view_read.type_handler_version - return - - cls._schema_virtual_machine_extension_instance_view_read = _schema_virtual_machine_extension_instance_view_read = AAZObjectType() - - virtual_machine_extension_instance_view_read = _schema_virtual_machine_extension_instance_view_read - virtual_machine_extension_instance_view_read.name = AAZStrType() - virtual_machine_extension_instance_view_read.statuses = AAZListType() - virtual_machine_extension_instance_view_read.substatuses = AAZListType() - virtual_machine_extension_instance_view_read.type = AAZStrType() - virtual_machine_extension_instance_view_read.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - statuses = _schema_virtual_machine_extension_instance_view_read.statuses - statuses.Element = AAZObjectType() - cls._build_schema_instance_view_status_read(statuses.Element) - - substatuses = _schema_virtual_machine_extension_instance_view_read.substatuses - substatuses.Element = AAZObjectType() - cls._build_schema_instance_view_status_read(substatuses.Element) - - _schema.name = cls._schema_virtual_machine_extension_instance_view_read.name - _schema.statuses = cls._schema_virtual_machine_extension_instance_view_read.statuses - _schema.substatuses = cls._schema_virtual_machine_extension_instance_view_read.substatuses - _schema.type = cls._schema_virtual_machine_extension_instance_view_read.type - _schema.type_handler_version = cls._schema_virtual_machine_extension_instance_view_read.type_handler_version - - -__all__ = ["ListInstances"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_skus.py deleted file mode 100644 index beb9e8b0a73..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/_list_skus.py +++ /dev/null @@ -1,200 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list-skus", -) -class ListSkus(AAZCommand): - """List SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/skus", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetsListSkus(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetsListSkus(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.capacity = AAZObjectType() - _element.resource_type = AAZStrType( - serialized_name="resourceType", - flags={"read_only": True}, - ) - _element.sku = AAZObjectType() - - capacity = cls._schema_on_200.value.Element.capacity - capacity.default_capacity = AAZIntType( - serialized_name="defaultCapacity", - flags={"read_only": True}, - ) - capacity.maximum = AAZIntType( - flags={"read_only": True}, - ) - capacity.minimum = AAZIntType( - flags={"read_only": True}, - ) - capacity.scale_type = AAZStrType( - serialized_name="scaleType", - flags={"read_only": True}, - ) - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/__cmd_group.py deleted file mode 100644 index 9a043b70dae..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic", -) -class __CMDGroup(AAZCommandGroup): - """Manage network interfaces of a VMSS. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/__init__.py deleted file mode 100644 index f929fbbe945..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._list_vm_nics import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_list.py deleted file mode 100644 index 96947456a9c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_list.py +++ /dev/null @@ -1,800 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic list", -) -class List(AAZCommand): - """Get all network interfaces in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/networkinterfaces", "2016-03-30"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesListVirtualMachineScaleSetNetworkInterfaces(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesListVirtualMachineScaleSetNetworkInterfaces(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_list_vm_nics.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_list_vm_nics.py deleted file mode 100644 index d2611c73142..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_list_vm_nics.py +++ /dev/null @@ -1,809 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic list-vm-nics", -) -class ListVmNics(AAZCommand): - """Get information about all network interfaces in a virtual machine in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines/{}/networkinterfaces", "2016-03-30"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name.", - required=True, - ) - _args_schema.virtualmachine_index = AAZStrArg( - options=["--instance-id", "--virtualmachine-index"], - help="The virtual machine index.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfaces(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfaces(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - **self.serialize_url_param( - "virtualmachineIndex", self.ctx.args.virtualmachine_index, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListVmNicsHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListVmNicsHelper: - """Helper class for ListVmNics""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["ListVmNics"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_show.py deleted file mode 100644 index 62fe3196cd3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/nic/_show.py +++ /dev/null @@ -1,819 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic show", -) -class Show(AAZCommand): - """Get the specified network interface in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines/{}/networkinterfaces/{}", "2016-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.network_interface_name = AAZStrArg( - options=["-n", "--name", "--network-interface-name"], - help="The network interface (NIC).", - required=True, - id_part="child_name_2", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name.", - required=True, - id_part="name", - ) - _args_schema.virtualmachine_index = AAZStrArg( - options=["--instance-id", "--virtualmachine-index"], - help="The virtual machine index.", - required=True, - id_part="child_name_1", - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGetVirtualMachineScaleSetNetworkInterface(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 NetworkInterfacesGetVirtualMachineScaleSetNetworkInterface(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.network_interface_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - **self.serialize_url_param( - "virtualmachineIndex", self.ctx.args.virtualmachine_index, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/__cmd_group.py deleted file mode 100644 index 8cfa2e80689..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade", -) -class __CMDGroup(AAZCommandGroup): - """Manage rolling upgrades. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/__init__.py deleted file mode 100644 index c1d51771410..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._cancel import * -from ._get_latest import * -from ._start import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_cancel.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_cancel.py deleted file mode 100644 index 73ecd2f9844..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_cancel.py +++ /dev/null @@ -1,148 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade cancel", -) -class Cancel(AAZCommand): - """Cancel the current virtual machine scale set rolling upgrade. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/rollingupgrades/cancel", "2022-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetRollingUpgradesCancel(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetRollingUpgradesCancel(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _CancelHelper: - """Helper class for Cancel""" - - -__all__ = ["Cancel"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_get_latest.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_get_latest.py deleted file mode 100644 index 1cc31960367..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_get_latest.py +++ /dev/null @@ -1,290 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade get-latest", -) -class GetLatest(AAZCommand): - """Get the status of the latest virtual machine scale set rolling upgrade. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/rollingupgrades/latest", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetRollingUpgradesGetLatest(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 VirtualMachineScaleSetRollingUpgradesGetLatest(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.error = AAZObjectType() - _GetLatestHelper._build_schema_api_error_read(properties.error) - properties.policy = AAZObjectType() - properties.progress = AAZObjectType() - properties.running_status = AAZObjectType( - serialized_name="runningStatus", - ) - - policy = cls._schema_on_200.properties.policy - policy.enable_cross_zone_upgrade = AAZBoolType( - serialized_name="enableCrossZoneUpgrade", - ) - policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - policy.max_surge = AAZBoolType( - serialized_name="maxSurge", - ) - policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - policy.prioritize_unhealthy_instances = AAZBoolType( - serialized_name="prioritizeUnhealthyInstances", - ) - policy.rollback_failed_instances_on_policy_breach = AAZBoolType( - serialized_name="rollbackFailedInstancesOnPolicyBreach", - ) - - progress = cls._schema_on_200.properties.progress - progress.failed_instance_count = AAZIntType( - serialized_name="failedInstanceCount", - flags={"read_only": True}, - ) - progress.in_progress_instance_count = AAZIntType( - serialized_name="inProgressInstanceCount", - flags={"read_only": True}, - ) - progress.pending_instance_count = AAZIntType( - serialized_name="pendingInstanceCount", - flags={"read_only": True}, - ) - progress.successful_instance_count = AAZIntType( - serialized_name="successfulInstanceCount", - flags={"read_only": True}, - ) - - running_status = cls._schema_on_200.properties.running_status - running_status.code = AAZStrType( - flags={"read_only": True}, - ) - running_status.last_action = AAZStrType( - serialized_name="lastAction", - flags={"read_only": True}, - ) - running_status.last_action_time = AAZStrType( - serialized_name="lastActionTime", - flags={"read_only": True}, - ) - running_status.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _GetLatestHelper: - """Helper class for GetLatest""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType() - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - -__all__ = ["GetLatest"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_start.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_start.py deleted file mode 100644 index 816e0ad19d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2018_03_01_hybrid/vmss/rolling_upgrade/_start.py +++ /dev/null @@ -1,148 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade start", -) -class Start(AAZCommand): - """Start a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version. Instances which are already running the latest available OS version are not affected. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/osrollingupgrade", "2022-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetRollingUpgradesStartOSUpgrade(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetRollingUpgradesStartOSUpgrade(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _StartHelper: - """Helper class for Start""" - - -__all__ = ["Start"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/__init__.py deleted file mode 100644 index f6acc11aa4e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 - diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/__cmd_group.py deleted file mode 100644 index a10530cf097..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/__cmd_group.py deleted file mode 100644 index 58d1554a9a5..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity reservation. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/__cmd_group.py deleted file mode 100644 index 84dd1dd45a2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation group", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity reservation group. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/__init__.py deleted file mode 100644 index d63ae5a6fc9..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/_list.py deleted file mode 100644 index 0d8796f5f6e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/capacity/reservation/group/_list.py +++ /dev/null @@ -1,519 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation group list", -) -class List(AAZCommand): - """List the capacity reservation groups. - - :example: List capacity reservation groups - az capacity reservation group list -g rg - - :example: List the capacity reservation groups containing VM instances and VMSS instance which are associated to capacity reservation group - az capacity reservation group list -g rg --vm-instance --vmss-instance - """ - - _aaz_info = { - "version": "2024-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/capacityreservationgroups", "2024-03-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/capacityreservationgroups", "2024-03-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response.", - enum={"virtualMachineScaleSetVMs/$ref": "virtualMachineScaleSetVMs/$ref", "virtualMachines/$ref": "virtualMachines/$ref"}, - ) - _args_schema.resource_ids_only = AAZStrArg( - options=["--resource-ids-only"], - help="The query option to fetch capacity reservation group resource Ids. 'CreatedInSubscription' enables fetching resource Ids for all capacity reservation group resources created in the subscription. 'SharedWithSubscription' enables fetching resource Ids for all capacity reservation group resources shared with the subscription. 'All' enables fetching resource Ids for all capacity reservation group resources shared with the subscription and created in the subscription.", - enum={"All": "All", "CreatedInSubscription": "CreatedInSubscription", "SharedWithSubscription": "SharedWithSubscription"}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.CapacityReservationGroupsListBySubscription(ctx=self.ctx)() - if condition_1: - self.CapacityReservationGroupsListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class CapacityReservationGroupsListBySubscription(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.Compute/capacityReservationGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "resourceIdsOnly", self.ctx.args.resource_ids_only, - ), - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - flags={"read_only": True}, - ) - properties.sharing_profile = AAZObjectType( - serialized_name="sharingProfile", - ) - properties.virtual_machines_associated = AAZListType( - serialized_name="virtualMachinesAssociated", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.capacity_reservations - capacity_reservations.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(capacity_reservations.Element) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - instance_view.shared_subscription_ids = AAZListType( - serialized_name="sharedSubscriptionIds", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations - capacity_reservations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.statuses = AAZListType() - _element.utilization_info = AAZObjectType( - serialized_name="utilizationInfo", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - utilization_info = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info - utilization_info.current_capacity = AAZIntType( - serialized_name="currentCapacity", - flags={"read_only": True}, - ) - utilization_info.virtual_machines_allocated = AAZListType( - serialized_name="virtualMachinesAllocated", - flags={"read_only": True}, - ) - - virtual_machines_allocated = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info.virtual_machines_allocated - virtual_machines_allocated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_allocated.Element) - - shared_subscription_ids = cls._schema_on_200.value.Element.properties.instance_view.shared_subscription_ids - shared_subscription_ids.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(shared_subscription_ids.Element) - - sharing_profile = cls._schema_on_200.value.Element.properties.sharing_profile - sharing_profile.subscription_ids = AAZListType( - serialized_name="subscriptionIds", - ) - - subscription_ids = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids - subscription_ids.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids.Element - _element.id = AAZStrType() - - virtual_machines_associated = cls._schema_on_200.value.Element.properties.virtual_machines_associated - virtual_machines_associated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_associated.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class CapacityReservationGroupsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - flags={"read_only": True}, - ) - properties.sharing_profile = AAZObjectType( - serialized_name="sharingProfile", - ) - properties.virtual_machines_associated = AAZListType( - serialized_name="virtualMachinesAssociated", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.capacity_reservations - capacity_reservations.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(capacity_reservations.Element) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - instance_view.shared_subscription_ids = AAZListType( - serialized_name="sharedSubscriptionIds", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations - capacity_reservations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.statuses = AAZListType() - _element.utilization_info = AAZObjectType( - serialized_name="utilizationInfo", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - utilization_info = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info - utilization_info.current_capacity = AAZIntType( - serialized_name="currentCapacity", - flags={"read_only": True}, - ) - utilization_info.virtual_machines_allocated = AAZListType( - serialized_name="virtualMachinesAllocated", - flags={"read_only": True}, - ) - - virtual_machines_allocated = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info.virtual_machines_allocated - virtual_machines_allocated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_allocated.Element) - - shared_subscription_ids = cls._schema_on_200.value.Element.properties.instance_view.shared_subscription_ids - shared_subscription_ids.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(shared_subscription_ids.Element) - - sharing_profile = cls._schema_on_200.value.Element.properties.sharing_profile - sharing_profile.subscription_ids = AAZListType( - serialized_name="subscriptionIds", - ) - - subscription_ids = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids - subscription_ids.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids.Element - _element.id = AAZStrType() - - virtual_machines_associated = cls._schema_on_200.value.Element.properties.virtual_machines_associated - virtual_machines_associated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_associated.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_sub_resource_read_only_read = None - - @classmethod - def _build_schema_sub_resource_read_only_read(cls, _schema): - if cls._schema_sub_resource_read_only_read is not None: - _schema.id = cls._schema_sub_resource_read_only_read.id - return - - cls._schema_sub_resource_read_only_read = _schema_sub_resource_read_only_read = AAZObjectType() - - sub_resource_read_only_read = _schema_sub_resource_read_only_read - sub_resource_read_only_read.id = AAZStrType( - flags={"read_only": True}, - ) - - _schema.id = cls._schema_sub_resource_read_only_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/__cmd_group.py deleted file mode 100644 index ef273230237..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/__cmd_group.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk", -) -class __CMDGroup(AAZCommandGroup): - """Manage Azure Managed Disks. - - Azure Virtual Machines use disks as a place to store an operating system, applications, and data. All Azure virtual machines have at least two disks: An operating system disk, and a temporary disk. The operating system disk is created from an image, and both the operating system disk and the image are actually virtual hard disks (VHDs) stored in an Azure storage account. Virtual machines also can have one or more data disks, that are also stored as VHDs. - Azure Unmanaged Data Disks have a maximum size of 4095 GB. To use disks larger than 4095 GB use [Azure Managed Disks](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview) - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/__init__.py deleted file mode 100644 index 59700973595..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._grant_access import * -from ._list import * -from ._revoke_access import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_create.py deleted file mode 100644 index 5aca5a87313..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_create.py +++ /dev/null @@ -1,611 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk create", -) -class Create(AAZCommand): - """Create a managed disk. - - :example: Create a managed disk by importing from a blob uri. - az disk create -g MyResourceGroup -n MyDisk --source https://vhd1234.blob.core.windows.net/vhds/osdisk1234.vhd - - :example: Create an empty managed disk. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 - - :example: Create an empty managed disk with bursting enabled. - az disk create -g MyResourceGroup -n MyDisk --size-gb 1024 --location centraluseuap --enable-bursting - - :example: Create a managed disk by copying an existing disk or snapshot. - az disk create -g MyResourceGroup -n MyDisk2 --source MyDisk - - :example: Create a disk in an availability zone in the region of "East US 2". - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --location eastus2 --zone 1 - - :example: Create a disk from image. - az disk create -g MyResourceGroup -n MyDisk --image-reference Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest - - :example: Create a disk from the OS Disk of a compute gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.0.0 - - :example: Create a disk from the OS Disk of the latest version in a compute gallery image. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage - - :example: Create a disk from the OS Disk of a shared gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /SharedGalleries/sharedGalleryUniqueName/Images/imageName/Versions/1.0.0 - - :example: Create a disk from the OS Disk of a community gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /CommunityGalleries/communityGalleryPublicGalleryName/Images/imageName/Versions/1.0.0 - - :example: Create a disk from the Data Disk of a gallery image. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.0.0 --gallery-image-reference-lun 0 - - :example: Create a disk with total number of IOPS and total throughput (MBps) limitation. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --sku UltraSSD_LRS --disk-iops-read-only 200 --disk-mbps-read-only 30 - - :example: Create a disk and specify maximum number of VMs that can attach to the disk at the same time. - az disk create -g MyResourceGroup -n MyDisk --size-gb 256 --max-shares 2 -l centraluseuap - - :example: Create a disk and associate it with a disk access resource. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Create a disk from the blob URI for VM guest state VHD. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --security-data-uri GuestStateDiskVhdUri --security-type TrustedLaunch --hyper-v-generation V2 - - :example: Create a standard disk for uploading blobs. - az disk create -g MyResourceGroup -n MyDisk --upload-size-bytes 20972032 --upload-type Upload - - :example: Create an OS disk for uploading along with VM guest state. - az disk create -g MyResourceGroup -n MyDisk --upload-size-bytes 20972032 --upload-type UploadWithSecurityData --security-type TrustedLaunch --hyper-v-generation V2 - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Disk" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Disk", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - arg_group="Disk", - help="The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS.", - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Disk", - help="Resource tags", - ) - _args_schema.zones = AAZListArg( - options=["--zones"], - arg_group="Disk", - help="The Logical zone list for Disk.", - ) - - sku = cls._args_schema.sku - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - zones = cls._args_schema.zones - zones.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.creation_data = AAZObjectArg( - options=["--creation-data"], - arg_group="Properties", - help="Disk source information. CreationData information cannot be changed after the disk has been created.", - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["--disk-size-gb"], - arg_group="Properties", - help="If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.", - ) - _args_schema.encryption_settings = AAZObjectArg( - options=["--encryption-settings"], - arg_group="Properties", - help="Encryption settings for disk or snapshot", - ) - _args_schema.os_type = AAZStrArg( - options=["--os-type"], - arg_group="Properties", - help="The Operating System type.", - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - - creation_data = cls._args_schema.creation_data - creation_data.create_option = AAZStrArg( - options=["create-option"], - help="This enumerates the possible sources of a disk's creation.", - required=True, - enum={"Attach": "Attach", "Copy": "Copy", "Empty": "Empty", "FromImage": "FromImage", "Import": "Import"}, - ) - creation_data.image_reference = AAZObjectArg( - options=["image-reference"], - help="Disk source information for PIR or user images.", - ) - creation_data.source_resource_id = AAZStrArg( - options=["source-resource-id"], - help="If createOption is Copy, this is the ARM id of the source snapshot or disk.", - ) - creation_data.source_uri = AAZStrArg( - options=["source-uri"], - help="If createOption is Import, this is the URI of a blob to be imported into a managed disk.", - ) - creation_data.storage_account_id = AAZStrArg( - options=["storage-account-id"], - help="Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk.", - ) - - image_reference = cls._args_schema.creation_data.image_reference - image_reference.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository or user image reference.", - ) - image_reference.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - ) - - encryption_settings = cls._args_schema.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectArg( - options=["disk-encryption-key"], - help="Key Vault Secret Url and vault id of the disk encryption key", - ) - encryption_settings.enabled = AAZBoolArg( - options=["enabled"], - help="Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.", - ) - encryption_settings.key_encryption_key = AAZObjectArg( - options=["key-encryption-key"], - help="Key Vault Key Url and vault id of the key encryption key", - ) - - disk_encryption_key = cls._args_schema.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrArg( - options=["secret-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - disk_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(disk_encryption_key.source_vault) - - key_encryption_key = cls._args_schema.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrArg( - options=["key-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - key_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(key_encryption_key.source_vault) - return cls._args_schema - - _args_source_vault_create = None - - @classmethod - def _build_args_source_vault_create(cls, _schema): - if cls._args_source_vault_create is not None: - _schema.id = cls._args_source_vault_create.id - return - - cls._args_source_vault_create = AAZObjectArg() - - source_vault_create = cls._args_source_vault_create - source_vault_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_source_vault_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.DisksCreateOrUpdate(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 DisksCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - _builder.set_prop("tags", AAZDictType, ".tags") - _builder.set_prop("zones", AAZListType, ".zones") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("creationData", AAZObjectType, ".creation_data", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryptionSettings", AAZObjectType, ".encryption_settings") - properties.set_prop("osType", AAZStrType, ".os_type") - - creation_data = _builder.get(".properties.creationData") - if creation_data is not None: - creation_data.set_prop("createOption", AAZStrType, ".create_option", typ_kwargs={"flags": {"required": True}}) - creation_data.set_prop("imageReference", AAZObjectType, ".image_reference") - creation_data.set_prop("sourceResourceId", AAZStrType, ".source_resource_id") - creation_data.set_prop("sourceUri", AAZStrType, ".source_uri") - creation_data.set_prop("storageAccountId", AAZStrType, ".storage_account_id") - - image_reference = _builder.get(".properties.creationData.imageReference") - if image_reference is not None: - image_reference.set_prop("id", AAZStrType, ".id") - image_reference.set_prop("lun", AAZIntType, ".lun") - - encryption_settings = _builder.get(".properties.encryptionSettings") - if encryption_settings is not None: - encryption_settings.set_prop("diskEncryptionKey", AAZObjectType, ".disk_encryption_key") - encryption_settings.set_prop("enabled", AAZBoolType, ".enabled") - encryption_settings.set_prop("keyEncryptionKey", AAZObjectType, ".key_encryption_key") - - disk_encryption_key = _builder.get(".properties.encryptionSettings.diskEncryptionKey") - if disk_encryption_key is not None: - disk_encryption_key.set_prop("secretUrl", AAZStrType, ".secret_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(disk_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - key_encryption_key = _builder.get(".properties.encryptionSettings.keyEncryptionKey") - if key_encryption_key is not None: - key_encryption_key.set_prop("keyUrl", AAZStrType, ".key_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(key_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".name") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - zones = _builder.get(".zones") - if zones is not None: - zones.set_elements(AAZStrType, ".") - - 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() - _CreateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_source_vault_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_disk_read = None - - @classmethod - def _build_schema_disk_read(cls, _schema): - if cls._schema_disk_read is not None: - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - return - - cls._schema_disk_read = _schema_disk_read = AAZObjectType() - - disk_read = _schema_disk_read - disk_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_read.location = AAZStrType( - flags={"required": True}, - ) - disk_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - disk_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_read.sku = AAZObjectType() - disk_read.tags = AAZDictType() - disk_read.type = AAZStrType( - flags={"read_only": True}, - ) - disk_read.zones = AAZListType() - - properties = _schema_disk_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = _schema_disk_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = _schema_disk_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = _schema_disk_read.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_read.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_read.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_disk_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_disk_read.tags - tags.Element = AAZStrType() - - zones = _schema_disk_read.zones - zones.Element = AAZStrType() - - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_delete.py deleted file mode 100644 index 22166023d7d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_delete.py +++ /dev/null @@ -1,230 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete a managed disk. - - :example: Delete a managed disk. - az disk delete --name MyManagedDisk --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksDelete(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 DisksDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_grant_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_grant_access.py deleted file mode 100644 index 4159b597881..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_grant_access.py +++ /dev/null @@ -1,231 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk grant-access", -) -class GrantAccess(AAZCommand): - """Grant a resource access to a managed disk. - - :example: Grant a resource read access to a managed disk. - az disk grant-access --access-level Read --duration-in-seconds 3600 --name MyManagedDisk --resource-group MyResourceGroup - - :example: Grant a resource read access to a disk to generate access SAS and security data access SAS - az disk grant-access --access-level Read --duration-in-seconds 3600 --name MyDisk --resource-group MyResourceGroup --secure-vm-guest-state-sas - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}/begingetaccess", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "GrantAccessData" - - _args_schema = cls._args_schema - _args_schema.access_level = AAZStrArg( - options=["--access", "--access-level"], - arg_group="GrantAccessData", - help="Access level.", - required=True, - default="Read", - enum={"None": "None", "Read": "Read"}, - ) - _args_schema.duration_in_seconds = AAZIntArg( - options=["--duration-in-seconds"], - arg_group="GrantAccessData", - help="Time duration in seconds until the SAS access expires.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksGrantAccess(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 DisksGrantAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - **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( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - 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("access", AAZStrType, ".access_level", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("durationInSeconds", AAZIntType, ".duration_in_seconds", 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.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties - properties.output = AAZObjectType( - flags={"client_flatten": True}, - ) - - output = cls._schema_on_200.properties.output - output.access_sas = AAZStrType( - serialized_name="accessSAS", - flags={"read_only": True}, - ) - - return cls._schema_on_200 - - -class _GrantAccessHelper: - """Helper class for GrantAccess""" - - -__all__ = ["GrantAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_list.py deleted file mode 100644 index 354681b6c10..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_list.py +++ /dev/null @@ -1,494 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk list", -) -class List(AAZCommand): - """List managed disks. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/disks", "2017-03-30"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.DisksList(ctx=self.ctx)() - if condition_1: - self.DisksListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class DisksList(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.Compute/disks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class DisksListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_revoke_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_revoke_access.py deleted file mode 100644 index e75d92c951a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_revoke_access.py +++ /dev/null @@ -1,218 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk revoke-access", -) -class RevokeAccess(AAZCommand): - """Revoke a resource's read access to a managed disk. - - :example: Revoke a resource's read access to a managed disk. - az disk revoke-access --ids $id - - :example: Revoke a resource's read access to a managed disk. - az disk revoke-access --name MyManagedDisk --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}/endgetaccess", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksRevokeAccess(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 DisksRevokeAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - **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( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _RevokeAccessHelper: - """Helper class for RevokeAccess""" - - -__all__ = ["RevokeAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_show.py deleted file mode 100644 index 3d7bf84f58c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_show.py +++ /dev/null @@ -1,286 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk show", -) -class Show(AAZCommand): - """Get information about a disk. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(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 DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.zones = AAZListType() - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_update.py deleted file mode 100644 index c35600bbb12..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_update.py +++ /dev/null @@ -1,906 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk update", -) -class Update(AAZCommand): - """Update a managed disk. - - :example: Update a managed disk and associate it with a disk access resource. - az disk update --name MyManagedDisk --resource-group MyResourceGroup --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Update a managed disk. - az disk update --name MyManagedDisk --resource-group MyResourceGroup --size-gb 20 - """ - - _aaz_info = { - "version": "2023-04-02", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2023-04-02"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.sku = AAZStrArg( - options=["--sku"], - help="Underlying storage SKU.", - nullable=True, - enum={"PremiumV2_LRS": "PremiumV2_LRS", "Premium_LRS": "Premium_LRS", "Premium_ZRS": "Premium_ZRS", "StandardSSD_LRS": "StandardSSD_LRS", "StandardSSD_ZRS": "StandardSSD_ZRS", "Standard_LRS": "Standard_LRS", "UltraSSD_LRS": "UltraSSD_LRS"}, - ) - - # define Arg Group "Disk" - - # define Arg Group "Encryption" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_id = AAZStrArg( - options=["--disk-encryption-set-id"], - arg_group="Encryption", - help="ResourceId of the disk encryption set to use for enabling encryption at rest.", - nullable=True, - ) - _args_schema.encryption_type = AAZStrArg( - options=["--encryption-type"], - arg_group="Encryption", - help={"short-summary": "Encryption type.", "long-summary": "EncryptionAtRestWithPlatformKey: Disk is encrypted with XStore managed key at rest. It is the default encryption type. EncryptionAtRestWithCustomerKey: Disk is encrypted with Customer managed key at rest."}, - nullable=True, - enum={"EncryptionAtRestWithCustomerKey": "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys": "EncryptionAtRestWithPlatformAndCustomerKeys", "EncryptionAtRestWithPlatformKey": "EncryptionAtRestWithPlatformKey"}, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.bursting_enabled = AAZBoolArg( - options=["--enable-bursting", "--bursting-enabled"], - arg_group="Properties", - help="Enable on-demand bursting beyond the provisioned performance target of the disk. On-demand bursting is disabled by default, and it does not apply to Ultra disks.", - nullable=True, - ) - _args_schema.data_access_auth_mode = AAZStrArg( - options=["--data-access-auth-mode"], - arg_group="Properties", - help="Specify the auth mode when exporting or uploading to a disk or snapshot.", - nullable=True, - enum={"AzureActiveDirectory": "AzureActiveDirectory", "None": "None"}, - ) - _args_schema.disk_access_id = AAZStrArg( - options=["--disk-access-id"], - arg_group="Properties", - help="ARM id of the DiskAccess resource for using private endpoints on disks.", - nullable=True, - ) - _args_schema.disk_iops_read_only = AAZIntArg( - options=["--disk-iops-read-only"], - arg_group="Properties", - help="The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes.", - nullable=True, - ) - _args_schema.disk_iops_read_write = AAZIntArg( - options=["--disk-iops-read-write"], - arg_group="Properties", - help="The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.", - nullable=True, - ) - _args_schema.disk_mbps_read_only = AAZIntArg( - options=["--disk-mbps-read-only"], - arg_group="Properties", - help="The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.", - nullable=True, - ) - _args_schema.disk_mbps_read_write = AAZIntArg( - options=["--disk-mbps-read-write"], - arg_group="Properties", - help="The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.", - nullable=True, - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["-z", "--size-gb", "--disk-size-gb"], - arg_group="Properties", - help="Size in GB. Max size: 4095 GB (certain preview disks can be larger).", - nullable=True, - ) - _args_schema.max_shares = AAZIntArg( - options=["--max-shares"], - arg_group="Properties", - help="The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time.", - nullable=True, - ) - _args_schema.network_access_policy = AAZStrArg( - options=["--network-access-policy"], - arg_group="Properties", - help="Policy for accessing the disk via network.", - nullable=True, - enum={"AllowAll": "AllowAll", "AllowPrivate": "AllowPrivate", "DenyAll": "DenyAll"}, - ) - _args_schema.public_network_access = AAZStrArg( - options=["--public-network-access"], - arg_group="Properties", - help="Customers can set on Managed Disks or Snapshots to control the export policy on the disk.", - is_preview=True, - nullable=True, - enum={"Disabled": "Disabled", "Enabled": "Enabled"}, - ) - - # define Arg Group "SupportedCapabilities" - - _args_schema = cls._args_schema - _args_schema.accelerated_network = AAZBoolArg( - options=["--accelerated-network"], - arg_group="SupportedCapabilities", - help="Customers can set on Managed Disks or Snapshots to enable the accelerated networking if the OS disk image support.", - is_preview=True, - nullable=True, - ) - _args_schema.architecture = AAZStrArg( - options=["--architecture"], - arg_group="SupportedCapabilities", - help="CPU architecture supported by an OS disk.", - nullable=True, - enum={"Arm64": "Arm64", "x64": "x64"}, - ) - return cls._args_schema - - _args_image_disk_reference_update = None - - @classmethod - def _build_args_image_disk_reference_update(cls, _schema): - if cls._args_image_disk_reference_update is not None: - _schema.community_gallery_image_id = cls._args_image_disk_reference_update.community_gallery_image_id - _schema.id = cls._args_image_disk_reference_update.id - _schema.lun = cls._args_image_disk_reference_update.lun - _schema.shared_gallery_image_id = cls._args_image_disk_reference_update.shared_gallery_image_id - return - - cls._args_image_disk_reference_update = AAZObjectArg( - nullable=True, - ) - - image_disk_reference_update = cls._args_image_disk_reference_update - image_disk_reference_update.community_gallery_image_id = AAZStrArg( - options=["community-gallery-image-id"], - help="A relative uri containing a community Azure Compute Gallery image reference.", - nullable=True, - ) - image_disk_reference_update.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference.", - nullable=True, - ) - image_disk_reference_update.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - nullable=True, - ) - image_disk_reference_update.shared_gallery_image_id = AAZStrArg( - options=["shared-gallery-image-id"], - help="A relative uri containing a direct shared Azure Compute Gallery image reference.", - nullable=True, - ) - - _schema.community_gallery_image_id = cls._args_image_disk_reference_update.community_gallery_image_id - _schema.id = cls._args_image_disk_reference_update.id - _schema.lun = cls._args_image_disk_reference_update.lun - _schema.shared_gallery_image_id = cls._args_image_disk_reference_update.shared_gallery_image_id - - _args_source_vault_update = None - - @classmethod - def _build_args_source_vault_update(cls, _schema): - if cls._args_source_vault_update is not None: - _schema.id = cls._args_source_vault_update.id - return - - cls._args_source_vault_update = AAZObjectArg() - - source_vault_update = cls._args_source_vault_update - source_vault_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_source_vault_update.id - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.DisksCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - class DisksCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("burstingEnabled", AAZBoolType, ".bursting_enabled") - properties.set_prop("dataAccessAuthMode", AAZStrType, ".data_access_auth_mode") - properties.set_prop("diskAccessId", AAZStrType, ".disk_access_id") - properties.set_prop("diskIOPSReadOnly", AAZIntType, ".disk_iops_read_only") - properties.set_prop("diskIOPSReadWrite", AAZIntType, ".disk_iops_read_write") - properties.set_prop("diskMBpsReadOnly", AAZIntType, ".disk_mbps_read_only") - properties.set_prop("diskMBpsReadWrite", AAZIntType, ".disk_mbps_read_write") - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryption", AAZObjectType) - properties.set_prop("maxShares", AAZIntType, ".max_shares") - properties.set_prop("networkAccessPolicy", AAZStrType, ".network_access_policy") - properties.set_prop("publicNetworkAccess", AAZStrType, ".public_network_access") - properties.set_prop("supportedCapabilities", AAZObjectType) - - encryption = _builder.get(".properties.encryption") - if encryption is not None: - encryption.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - encryption.set_prop("type", AAZStrType, ".encryption_type") - - supported_capabilities = _builder.get(".properties.supportedCapabilities") - if supported_capabilities is not None: - supported_capabilities.set_prop("acceleratedNetwork", AAZBoolType, ".accelerated_network") - supported_capabilities.set_prop("architecture", AAZStrType, ".architecture") - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".sku") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_image_disk_reference_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("communityGalleryImageId", AAZStrType, ".community_gallery_image_id") - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("lun", AAZIntType, ".lun") - _builder.set_prop("sharedGalleryImageId", AAZStrType, ".shared_gallery_image_id") - - @classmethod - def _build_schema_source_vault_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_disk_read = None - - @classmethod - def _build_schema_disk_read(cls, _schema): - if cls._schema_disk_read is not None: - _schema.extended_location = cls._schema_disk_read.extended_location - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.managed_by_extended = cls._schema_disk_read.managed_by_extended - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - return - - cls._schema_disk_read = _schema_disk_read = AAZObjectType() - - disk_read = _schema_disk_read - disk_read.extended_location = AAZObjectType( - serialized_name="extendedLocation", - ) - disk_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_read.location = AAZStrType( - flags={"required": True}, - ) - disk_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - disk_read.managed_by_extended = AAZListType( - serialized_name="managedByExtended", - flags={"read_only": True}, - ) - disk_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_read.sku = AAZObjectType() - disk_read.tags = AAZDictType() - disk_read.type = AAZStrType( - flags={"read_only": True}, - ) - disk_read.zones = AAZListType() - - extended_location = _schema_disk_read.extended_location - extended_location.name = AAZStrType() - extended_location.type = AAZStrType() - - managed_by_extended = _schema_disk_read.managed_by_extended - managed_by_extended.Element = AAZStrType() - - properties = _schema_disk_read.properties - properties.last_ownership_update_time = AAZStrType( - serialized_name="LastOwnershipUpdateTime", - flags={"read_only": True}, - ) - properties.bursting_enabled = AAZBoolType( - serialized_name="burstingEnabled", - ) - properties.bursting_enabled_time = AAZStrType( - serialized_name="burstingEnabledTime", - flags={"read_only": True}, - ) - properties.completion_percent = AAZFloatType( - serialized_name="completionPercent", - ) - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.data_access_auth_mode = AAZStrType( - serialized_name="dataAccessAuthMode", - ) - properties.disk_access_id = AAZStrType( - serialized_name="diskAccessId", - ) - properties.disk_iops_read_only = AAZIntType( - serialized_name="diskIOPSReadOnly", - ) - properties.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - properties.disk_m_bps_read_only = AAZIntType( - serialized_name="diskMBpsReadOnly", - ) - properties.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.disk_state = AAZStrType( - serialized_name="diskState", - flags={"read_only": True}, - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.max_shares = AAZIntType( - serialized_name="maxShares", - ) - properties.network_access_policy = AAZStrType( - serialized_name="networkAccessPolicy", - ) - properties.optimized_for_frequent_attach = AAZBoolType( - serialized_name="optimizedForFrequentAttach", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.property_updates_in_progress = AAZObjectType( - serialized_name="propertyUpdatesInProgress", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_network_access = AAZStrType( - serialized_name="publicNetworkAccess", - ) - properties.purchase_plan = AAZObjectType( - serialized_name="purchasePlan", - ) - properties.security_profile = AAZObjectType( - serialized_name="securityProfile", - ) - properties.share_info = AAZListType( - serialized_name="shareInfo", - flags={"read_only": True}, - ) - properties.supported_capabilities = AAZObjectType( - serialized_name="supportedCapabilities", - ) - properties.supports_hibernation = AAZBoolType( - serialized_name="supportsHibernation", - ) - properties.tier = AAZStrType() - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = _schema_disk_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.elastic_san_resource_id = AAZStrType( - serialized_name="elasticSanResourceId", - ) - creation_data.gallery_image_reference = AAZObjectType( - serialized_name="galleryImageReference", - ) - cls._build_schema_image_disk_reference_read(creation_data.gallery_image_reference) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - cls._build_schema_image_disk_reference_read(creation_data.image_reference) - creation_data.logical_sector_size = AAZIntType( - serialized_name="logicalSectorSize", - ) - creation_data.performance_plus = AAZBoolType( - serialized_name="performancePlus", - ) - creation_data.security_data_uri = AAZStrType( - serialized_name="securityDataUri", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - encryption = _schema_disk_read.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = _schema_disk_read.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = _schema_disk_read.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - property_updates_in_progress = _schema_disk_read.properties.property_updates_in_progress - property_updates_in_progress.target_tier = AAZStrType( - serialized_name="targetTier", - ) - - purchase_plan = _schema_disk_read.properties.purchase_plan - purchase_plan.name = AAZStrType( - flags={"required": True}, - ) - purchase_plan.product = AAZStrType( - flags={"required": True}, - ) - purchase_plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - purchase_plan.publisher = AAZStrType( - flags={"required": True}, - ) - - security_profile = _schema_disk_read.properties.security_profile - security_profile.secure_vm_disk_encryption_set_id = AAZStrType( - serialized_name="secureVMDiskEncryptionSetId", - ) - security_profile.security_type = AAZStrType( - serialized_name="securityType", - ) - - share_info = _schema_disk_read.properties.share_info - share_info.Element = AAZObjectType() - - _element = _schema_disk_read.properties.share_info.Element - _element.vm_uri = AAZStrType( - serialized_name="vmUri", - flags={"read_only": True}, - ) - - supported_capabilities = _schema_disk_read.properties.supported_capabilities - supported_capabilities.accelerated_network = AAZBoolType( - serialized_name="acceleratedNetwork", - ) - supported_capabilities.architecture = AAZStrType() - supported_capabilities.disk_controller_types = AAZStrType( - serialized_name="diskControllerTypes", - ) - - sku = _schema_disk_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_disk_read.tags - tags.Element = AAZStrType() - - zones = _schema_disk_read.zones - zones.Element = AAZStrType() - - _schema.extended_location = cls._schema_disk_read.extended_location - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.managed_by_extended = cls._schema_disk_read.managed_by_extended - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - - _schema_image_disk_reference_read = None - - @classmethod - def _build_schema_image_disk_reference_read(cls, _schema): - if cls._schema_image_disk_reference_read is not None: - _schema.community_gallery_image_id = cls._schema_image_disk_reference_read.community_gallery_image_id - _schema.id = cls._schema_image_disk_reference_read.id - _schema.lun = cls._schema_image_disk_reference_read.lun - _schema.shared_gallery_image_id = cls._schema_image_disk_reference_read.shared_gallery_image_id - return - - cls._schema_image_disk_reference_read = _schema_image_disk_reference_read = AAZObjectType() - - image_disk_reference_read = _schema_image_disk_reference_read - image_disk_reference_read.community_gallery_image_id = AAZStrType( - serialized_name="communityGalleryImageId", - ) - image_disk_reference_read.id = AAZStrType() - image_disk_reference_read.lun = AAZIntType() - image_disk_reference_read.shared_gallery_image_id = AAZStrType( - serialized_name="sharedGalleryImageId", - ) - - _schema.community_gallery_image_id = cls._schema_image_disk_reference_read.community_gallery_image_id - _schema.id = cls._schema_image_disk_reference_read.id - _schema.lun = cls._schema_image_disk_reference_read.lun - _schema.shared_gallery_image_id = cls._schema_image_disk_reference_read.shared_gallery_image_id - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_wait.py deleted file mode 100644 index 5cd5f7fb85f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/disk/_wait.py +++ /dev/null @@ -1,285 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(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=False) - return result - - class DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.zones = AAZListType() - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/__cmd_group.py deleted file mode 100644 index 3e4a7f17f85..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image", -) -class __CMDGroup(AAZCommandGroup): - """Manage custom virtual machine images. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_create.py deleted file mode 100644 index 7c33225be5b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_create.py +++ /dev/null @@ -1,536 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image create", -) -class Create(AAZCommand): - """Create a custom Virtual Machine Image from managed disks or snapshots. - - :example: Create an image from an existing disk. - az image create -g MyResourceGroup -n image1 --os-type Linux --source /subscriptions/db5eb68e-73e2-4fa8-b18a-0123456789999/resourceGroups/rg1/providers/Microsoft.Compute/snapshots/s1 - - :example: Create an image by capturing an existing generalized virtual machine in the same resource group. - az image create -g MyResourceGroup -n image1 --source MyVm1 - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.source_virtual_machine = AAZObjectArg( - options=["--source-virtual-machine"], - arg_group="Properties", - help="The source virtual machine from which Image is created.", - ) - _args_schema.storage_profile = AAZObjectArg( - options=["--storage-profile"], - arg_group="Properties", - help="Specifies the storage settings for the virtual machine disks.", - ) - - source_virtual_machine = cls._args_schema.source_virtual_machine - source_virtual_machine.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - storage_profile = cls._args_schema.storage_profile - storage_profile.data_disks = AAZListArg( - options=["data-disks"], - help="Specifies the parameters that are used to add a data disk to a virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview).", - ) - storage_profile.os_disk = AAZObjectArg( - options=["os-disk"], - help="Specifies information about the operating system disk used by the virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview).", - ) - storage_profile.zone_resilient = AAZBoolArg( - options=["zone-resilient"], - help="Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS).", - ) - - data_disks = cls._args_schema.storage_profile.data_disks - data_disks.Element = AAZObjectArg() - - _element = cls._args_schema.storage_profile.data_disks.Element - _element.blob_uri = AAZStrArg( - options=["blob-uri"], - help="The Virtual Hard Disk.", - ) - _element.caching = AAZStrArg( - options=["caching"], - help="Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**", - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - _element.disk_size_gb = AAZIntArg( - options=["disk-size-gb"], - help="Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB", - ) - _element.lun = AAZIntArg( - options=["lun"], - help="Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.", - required=True, - ) - _element.managed_disk = AAZObjectArg( - options=["managed-disk"], - help="The managedDisk.", - ) - _element.snapshot = AAZObjectArg( - options=["snapshot"], - help="The snapshot.", - ) - _element.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - managed_disk = cls._args_schema.storage_profile.data_disks.Element.managed_disk - managed_disk.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - snapshot = cls._args_schema.storage_profile.data_disks.Element.snapshot - snapshot.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - os_disk = cls._args_schema.storage_profile.os_disk - os_disk.blob_uri = AAZStrArg( - options=["blob-uri"], - help="The Virtual Hard Disk.", - ) - os_disk.caching = AAZStrArg( - options=["caching"], - help="Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**", - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - os_disk.disk_size_gb = AAZIntArg( - options=["disk-size-gb"], - help="Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB", - ) - os_disk.managed_disk = AAZObjectArg( - options=["managed-disk"], - help="The managedDisk.", - ) - cls._build_args_sub_resource_create(os_disk.managed_disk) - os_disk.os_state = AAZStrArg( - options=["os-state"], - help="The OS State. For managed images, use Generalized.", - required=True, - enum={"Generalized": "Generalized", "Specialized": "Specialized"}, - ) - os_disk.os_type = AAZStrArg( - options=["os-type"], - help="This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image.

Possible values are:

**Windows**

**Linux**", - required=True, - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - os_disk.snapshot = AAZObjectArg( - options=["snapshot"], - help="The snapshot.", - ) - os_disk.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - snapshot = cls._args_schema.storage_profile.os_disk.snapshot - snapshot.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - return cls._args_schema - - _args_sub_resource_create = None - - @classmethod - def _build_args_sub_resource_create(cls, _schema): - if cls._args_sub_resource_create is not None: - _schema.id = cls._args_sub_resource_create.id - return - - cls._args_sub_resource_create = AAZObjectArg() - - sub_resource_create = cls._args_sub_resource_create - sub_resource_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_sub_resource_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.ImagesCreateOrUpdate(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 ImagesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("sourceVirtualMachine", AAZObjectType, ".source_virtual_machine") - properties.set_prop("storageProfile", AAZObjectType, ".storage_profile") - - source_virtual_machine = _builder.get(".properties.sourceVirtualMachine") - if source_virtual_machine is not None: - source_virtual_machine.set_prop("id", AAZStrType, ".id") - - storage_profile = _builder.get(".properties.storageProfile") - if storage_profile is not None: - storage_profile.set_prop("dataDisks", AAZListType, ".data_disks") - storage_profile.set_prop("osDisk", AAZObjectType, ".os_disk") - storage_profile.set_prop("zoneResilient", AAZBoolType, ".zone_resilient") - - data_disks = _builder.get(".properties.storageProfile.dataDisks") - if data_disks is not None: - data_disks.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.storageProfile.dataDisks[]") - if _elements is not None: - _elements.set_prop("blobUri", AAZStrType, ".blob_uri") - _elements.set_prop("caching", AAZStrType, ".caching") - _elements.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - _elements.set_prop("lun", AAZIntType, ".lun", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("managedDisk", AAZObjectType, ".managed_disk") - _elements.set_prop("snapshot", AAZObjectType, ".snapshot") - _elements.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - - managed_disk = _builder.get(".properties.storageProfile.dataDisks[].managedDisk") - if managed_disk is not None: - managed_disk.set_prop("id", AAZStrType, ".id") - - snapshot = _builder.get(".properties.storageProfile.dataDisks[].snapshot") - if snapshot is not None: - snapshot.set_prop("id", AAZStrType, ".id") - - os_disk = _builder.get(".properties.storageProfile.osDisk") - if os_disk is not None: - os_disk.set_prop("blobUri", AAZStrType, ".blob_uri") - os_disk.set_prop("caching", AAZStrType, ".caching") - os_disk.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - _CreateHelper._build_schema_sub_resource_create(os_disk.set_prop("managedDisk", AAZObjectType, ".managed_disk")) - os_disk.set_prop("osState", AAZStrType, ".os_state", typ_kwargs={"flags": {"required": True}}) - os_disk.set_prop("osType", AAZStrType, ".os_type", typ_kwargs={"flags": {"required": True}}) - os_disk.set_prop("snapshot", AAZObjectType, ".snapshot") - os_disk.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - - snapshot = _builder.get(".properties.storageProfile.osDisk.snapshot") - if snapshot is not None: - snapshot.set_prop("id", AAZStrType, ".id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200_201.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _CreateHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200_201.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200_201.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _CreateHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _CreateHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200_201.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _CreateHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _CreateHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_sub_resource_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_delete.py deleted file mode 100644 index 3676bee5061..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_delete.py +++ /dev/null @@ -1,226 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image delete", -) -class Delete(AAZCommand): - """Delete an Image. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.ImagesDelete(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 ImagesDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_list.py deleted file mode 100644 index 4d00aeb935c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_list.py +++ /dev/null @@ -1,456 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image list", -) -class List(AAZCommand): - """List the list of images under a resource group. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/images", "2017-12-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images", "2017-12-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.ImagesList(ctx=self.ctx)() - if condition_1: - self.ImagesListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class ImagesList(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.Compute/images", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ListHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class ImagesListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ListHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_show.py deleted file mode 100644 index c4496b596f0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_show.py +++ /dev/null @@ -1,276 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image show", -) -class Show(AAZCommand): - """Get an image. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(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 ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ShowHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ShowHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ShowHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_update.py deleted file mode 100644 index 228bf7bfa7e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_update.py +++ /dev/null @@ -1,497 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image update", -) -class Update(AAZCommand): - """Update custom VM images. - - :example: Add or update tags. - az image update -n ImageName -g ResourceGroup --tags tag1=val1 tag2=val2 - - :example: Remove all tags. - az image update -n ImageName -g resourceGroup --tags - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "Properties" - return cls._args_schema - - _args_sub_resource_update = None - - @classmethod - def _build_args_sub_resource_update(cls, _schema): - if cls._args_sub_resource_update is not None: - _schema.id = cls._args_sub_resource_update.id - return - - cls._args_sub_resource_update = AAZObjectArg( - nullable=True, - ) - - sub_resource_update = cls._args_sub_resource_update - sub_resource_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_sub_resource_update.id - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.ImagesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_image_read(cls._schema_on_200) - - return cls._schema_on_200 - - class ImagesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_image_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_sub_resource_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_image_read = None - - @classmethod - def _build_schema_image_read(cls, _schema): - if cls._schema_image_read is not None: - _schema.id = cls._schema_image_read.id - _schema.location = cls._schema_image_read.location - _schema.name = cls._schema_image_read.name - _schema.properties = cls._schema_image_read.properties - _schema.tags = cls._schema_image_read.tags - _schema.type = cls._schema_image_read.type - return - - cls._schema_image_read = _schema_image_read = AAZObjectType() - - image_read = _schema_image_read - image_read.id = AAZStrType( - flags={"read_only": True}, - ) - image_read.location = AAZStrType( - flags={"required": True}, - ) - image_read.name = AAZStrType( - flags={"read_only": True}, - ) - image_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - image_read.tags = AAZDictType() - image_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_image_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - cls._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = _schema_image_read.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = _schema_image_read.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = _schema_image_read.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - cls._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - cls._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = _schema_image_read.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - cls._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - cls._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = _schema_image_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_image_read.id - _schema.location = cls._schema_image_read.location - _schema.name = cls._schema_image_read.name - _schema.properties = cls._schema_image_read.properties - _schema.tags = cls._schema_image_read.tags - _schema.type = cls._schema_image_read.type - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_wait.py deleted file mode 100644 index acd362202cf..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/image/_wait.py +++ /dev/null @@ -1,275 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(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=False) - return result - - class ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _WaitHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _WaitHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _WaitHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _WaitHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _WaitHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/__cmd_group.py deleted file mode 100644 index 7582bb60b24..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/__cmd_group.py +++ /dev/null @@ -1,20 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage Azure Network resources. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/__cmd_group.py deleted file mode 100644 index 4eb94459c8c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage application-level routing and load balancing services. - - To learn more about Application Gateway, visit https://learn.microsoft.com/en-us/azure/application-gateway/quick-create-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/__init__.py deleted file mode 100644 index 28d5f355813..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/_show.py deleted file mode 100644 index bcb67742ead..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/application_gateway/_show.py +++ /dev/null @@ -1,1489 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of an application gateway. - - :example: Get the details of an application gateway. - az network application-gateway show -g MyResourceGroup -n MyAppGateway - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the application gateway.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ApplicationGatewaysGet(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 ApplicationGatewaysGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "applicationGatewayName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType() - _schema_on_200.id = AAZStrType() - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.authentication_certificates = AAZListType( - serialized_name="authenticationCertificates", - ) - properties.backend_address_pools = AAZListType( - serialized_name="backendAddressPools", - ) - properties.backend_http_settings_collection = AAZListType( - serialized_name="backendHttpSettingsCollection", - ) - properties.enable_http2 = AAZBoolType( - serialized_name="enableHttp2", - ) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - ) - properties.frontend_ports = AAZListType( - serialized_name="frontendPorts", - ) - properties.gateway_ip_configurations = AAZListType( - serialized_name="gatewayIPConfigurations", - ) - properties.http_listeners = AAZListType( - serialized_name="httpListeners", - ) - properties.operational_state = AAZStrType( - serialized_name="operationalState", - flags={"read_only": True}, - ) - properties.probes = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configurations = AAZListType( - serialized_name="redirectConfigurations", - ) - properties.request_routing_rules = AAZListType( - serialized_name="requestRoutingRules", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.sku = AAZObjectType() - properties.ssl_certificates = AAZListType( - serialized_name="sslCertificates", - ) - properties.ssl_policy = AAZObjectType( - serialized_name="sslPolicy", - ) - properties.url_path_maps = AAZListType( - serialized_name="urlPathMaps", - ) - properties.web_application_firewall_configuration = AAZObjectType( - serialized_name="webApplicationFirewallConfiguration", - ) - - authentication_certificates = cls._schema_on_200.properties.authentication_certificates - authentication_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.authentication_certificates.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.authentication_certificates.Element.properties - properties.data = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_address_pools = cls._schema_on_200.properties.backend_address_pools - backend_address_pools.Element = AAZObjectType() - _ShowHelper._build_schema_application_gateway_backend_address_pool_read(backend_address_pools.Element) - - backend_http_settings_collection = cls._schema_on_200.properties.backend_http_settings_collection - backend_http_settings_collection.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.backend_http_settings_collection.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties - properties.affinity_cookie_name = AAZStrType( - serialized_name="affinityCookieName", - ) - properties.authentication_certificates = AAZListType( - serialized_name="authenticationCertificates", - ) - properties.connection_draining = AAZObjectType( - serialized_name="connectionDraining", - ) - properties.cookie_based_affinity = AAZStrType( - serialized_name="cookieBasedAffinity", - ) - properties.host_name = AAZStrType( - serialized_name="hostName", - ) - properties.path = AAZStrType() - properties.pick_host_name_from_backend_address = AAZBoolType( - serialized_name="pickHostNameFromBackendAddress", - ) - properties.port = AAZIntType() - properties.probe = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.probe) - properties.probe_enabled = AAZBoolType( - serialized_name="probeEnabled", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.request_timeout = AAZIntType( - serialized_name="requestTimeout", - ) - - authentication_certificates = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties.authentication_certificates - authentication_certificates.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(authentication_certificates.Element) - - connection_draining = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties.connection_draining - connection_draining.drain_timeout_in_sec = AAZIntType( - serialized_name="drainTimeoutInSec", - flags={"required": True}, - ) - connection_draining.enabled = AAZBoolType( - flags={"required": True}, - ) - - frontend_ip_configurations = cls._schema_on_200.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.frontend_ip_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - _ShowHelper._build_schema_sub_resource_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.subnet) - - frontend_ports = cls._schema_on_200.properties.frontend_ports - frontend_ports.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.frontend_ports.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.frontend_ports.Element.properties - properties.port = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - gateway_ip_configurations = cls._schema_on_200.properties.gateway_ip_configurations - gateway_ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.gateway_ip_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.gateway_ip_configurations.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.subnet = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.subnet) - - http_listeners = cls._schema_on_200.properties.http_listeners - http_listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.http_listeners.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.http_listeners.Element.properties - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZObjectType( - serialized_name="frontendPort", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_port) - properties.host_name = AAZStrType( - serialized_name="hostName", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.require_server_name_indication = AAZBoolType( - serialized_name="requireServerNameIndication", - ) - properties.ssl_certificate = AAZObjectType( - serialized_name="sslCertificate", - ) - _ShowHelper._build_schema_sub_resource_read(properties.ssl_certificate) - - probes = cls._schema_on_200.properties.probes - probes.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.probes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.probes.Element.properties - properties.host = AAZStrType() - properties.interval = AAZIntType() - properties.match = AAZObjectType() - properties.min_servers = AAZIntType( - serialized_name="minServers", - ) - properties.path = AAZStrType() - properties.pick_host_name_from_backend_http_settings = AAZBoolType( - serialized_name="pickHostNameFromBackendHttpSettings", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.timeout = AAZIntType() - properties.unhealthy_threshold = AAZIntType( - serialized_name="unhealthyThreshold", - ) - - match = cls._schema_on_200.properties.probes.Element.properties.match - match.body = AAZStrType() - match.status_codes = AAZListType( - serialized_name="statusCodes", - ) - - status_codes = cls._schema_on_200.properties.probes.Element.properties.match.status_codes - status_codes.Element = AAZStrType() - - redirect_configurations = cls._schema_on_200.properties.redirect_configurations - redirect_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.redirect_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.redirect_configurations.Element.properties - properties.include_path = AAZBoolType( - serialized_name="includePath", - ) - properties.include_query_string = AAZBoolType( - serialized_name="includeQueryString", - ) - properties.path_rules = AAZListType( - serialized_name="pathRules", - ) - properties.redirect_type = AAZStrType( - serialized_name="redirectType", - ) - properties.request_routing_rules = AAZListType( - serialized_name="requestRoutingRules", - ) - properties.target_listener = AAZObjectType( - serialized_name="targetListener", - ) - _ShowHelper._build_schema_sub_resource_read(properties.target_listener) - properties.target_url = AAZStrType( - serialized_name="targetUrl", - ) - properties.url_path_maps = AAZListType( - serialized_name="urlPathMaps", - ) - - path_rules = cls._schema_on_200.properties.redirect_configurations.Element.properties.path_rules - path_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(path_rules.Element) - - request_routing_rules = cls._schema_on_200.properties.redirect_configurations.Element.properties.request_routing_rules - request_routing_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(request_routing_rules.Element) - - url_path_maps = cls._schema_on_200.properties.redirect_configurations.Element.properties.url_path_maps - url_path_maps.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(url_path_maps.Element) - - request_routing_rules = cls._schema_on_200.properties.request_routing_rules - request_routing_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.request_routing_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.request_routing_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_http_settings = AAZObjectType( - serialized_name="backendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_http_settings) - properties.http_listener = AAZObjectType( - serialized_name="httpListener", - ) - _ShowHelper._build_schema_sub_resource_read(properties.http_listener) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configuration = AAZObjectType( - serialized_name="redirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.redirect_configuration) - properties.rule_type = AAZStrType( - serialized_name="ruleType", - ) - properties.url_path_map = AAZObjectType( - serialized_name="urlPathMap", - ) - _ShowHelper._build_schema_sub_resource_read(properties.url_path_map) - - sku = cls._schema_on_200.properties.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - ssl_certificates = cls._schema_on_200.properties.ssl_certificates - ssl_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.ssl_certificates.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.ssl_certificates.Element.properties - properties.data = AAZStrType() - properties.password = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_cert_data = AAZStrType( - serialized_name="publicCertData", - ) - - ssl_policy = cls._schema_on_200.properties.ssl_policy - ssl_policy.cipher_suites = AAZListType( - serialized_name="cipherSuites", - ) - ssl_policy.disabled_ssl_protocols = AAZListType( - serialized_name="disabledSslProtocols", - ) - ssl_policy.min_protocol_version = AAZStrType( - serialized_name="minProtocolVersion", - ) - ssl_policy.policy_name = AAZStrType( - serialized_name="policyName", - ) - ssl_policy.policy_type = AAZStrType( - serialized_name="policyType", - ) - - cipher_suites = cls._schema_on_200.properties.ssl_policy.cipher_suites - cipher_suites.Element = AAZStrType() - - disabled_ssl_protocols = cls._schema_on_200.properties.ssl_policy.disabled_ssl_protocols - disabled_ssl_protocols.Element = AAZStrType() - - url_path_maps = cls._schema_on_200.properties.url_path_maps - url_path_maps.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.url_path_maps.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.url_path_maps.Element.properties - properties.default_backend_address_pool = AAZObjectType( - serialized_name="defaultBackendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_backend_address_pool) - properties.default_backend_http_settings = AAZObjectType( - serialized_name="defaultBackendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_backend_http_settings) - properties.default_redirect_configuration = AAZObjectType( - serialized_name="defaultRedirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_redirect_configuration) - properties.path_rules = AAZListType( - serialized_name="pathRules", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - path_rules = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules - path_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_http_settings = AAZObjectType( - serialized_name="backendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_http_settings) - properties.paths = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configuration = AAZObjectType( - serialized_name="redirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.redirect_configuration) - - paths = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element.properties.paths - paths.Element = AAZStrType() - - web_application_firewall_configuration = cls._schema_on_200.properties.web_application_firewall_configuration - web_application_firewall_configuration.disabled_rule_groups = AAZListType( - serialized_name="disabledRuleGroups", - ) - web_application_firewall_configuration.enabled = AAZBoolType( - flags={"required": True}, - ) - web_application_firewall_configuration.firewall_mode = AAZStrType( - serialized_name="firewallMode", - flags={"required": True}, - ) - web_application_firewall_configuration.rule_set_type = AAZStrType( - serialized_name="ruleSetType", - flags={"required": True}, - ) - web_application_firewall_configuration.rule_set_version = AAZStrType( - serialized_name="ruleSetVersion", - flags={"required": True}, - ) - - disabled_rule_groups = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups - disabled_rule_groups.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups.Element - _element.rule_group_name = AAZStrType( - serialized_name="ruleGroupName", - flags={"required": True}, - ) - _element.rules = AAZListType() - - rules = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups.Element.rules - rules.Element = AAZIntType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_gateway_backend_address_pool_read = None - - @classmethod - def _build_schema_application_gateway_backend_address_pool_read(cls, _schema): - if cls._schema_application_gateway_backend_address_pool_read is not None: - _schema.etag = cls._schema_application_gateway_backend_address_pool_read.etag - _schema.id = cls._schema_application_gateway_backend_address_pool_read.id - _schema.name = cls._schema_application_gateway_backend_address_pool_read.name - _schema.properties = cls._schema_application_gateway_backend_address_pool_read.properties - _schema.type = cls._schema_application_gateway_backend_address_pool_read.type - return - - cls._schema_application_gateway_backend_address_pool_read = _schema_application_gateway_backend_address_pool_read = AAZObjectType() - - application_gateway_backend_address_pool_read = _schema_application_gateway_backend_address_pool_read - application_gateway_backend_address_pool_read.etag = AAZStrType() - application_gateway_backend_address_pool_read.id = AAZStrType() - application_gateway_backend_address_pool_read.name = AAZStrType() - application_gateway_backend_address_pool_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_gateway_backend_address_pool_read.type = AAZStrType() - - properties = _schema_application_gateway_backend_address_pool_read.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_application_gateway_backend_address_pool_read.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_application_gateway_backend_address_pool_read.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_application_gateway_backend_address_pool_read.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - _schema.etag = cls._schema_application_gateway_backend_address_pool_read.etag - _schema.id = cls._schema_application_gateway_backend_address_pool_read.id - _schema.name = cls._schema_application_gateway_backend_address_pool_read.name - _schema.properties = cls._schema_application_gateway_backend_address_pool_read.properties - _schema.type = cls._schema_application_gateway_backend_address_pool_read.type - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - cls._build_schema_application_gateway_backend_address_pool_read(application_gateway_backend_address_pools.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/__cmd_group.py deleted file mode 100644 index 9b5c68b709c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage and configure load balancers. - - To learn more about Azure Load Balancer visit https://learn.microsoft.com/en-us/azure/load-balancer/quickstart-load-balancer-standard-public-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/__init__.py deleted file mode 100644 index 28d5f355813..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/_show.py deleted file mode 100644 index 7c7a87047e3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/lb/_show.py +++ /dev/null @@ -1,1250 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a load balancer. - - :example: Get the details of a load balancer. - az network lb show -g MyResourceGroup -n MyLb - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/loadbalancers/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The load balancer name.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.LoadBalancersGet(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 LoadBalancersGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "loadBalancerName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType() - _schema_on_200.id = AAZStrType() - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.backend_address_pools = AAZListType( - serialized_name="backendAddressPools", - ) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - ) - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rules = AAZListType( - serialized_name="outboundNatRules", - ) - properties.probes = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - backend_address_pools = cls._schema_on_200.properties.backend_address_pools - backend_address_pools.Element = AAZObjectType() - _ShowHelper._build_schema_backend_address_pool_read(backend_address_pools.Element) - - frontend_ip_configurations = cls._schema_on_200.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.frontend_ip_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rules = AAZListType( - serialized_name="outboundNatRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - _ShowHelper._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - _ShowHelper._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_nat_rules = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties.outbound_nat_rules - outbound_nat_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(outbound_nat_rules.Element) - - zones = cls._schema_on_200.properties.frontend_ip_configurations.Element.zones - zones.Element = AAZStrType() - - inbound_nat_pools = cls._schema_on_200.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.inbound_nat_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.inbound_nat_pools.Element.properties - properties.backend_port = AAZIntType( - serialized_name="backendPort", - flags={"required": True}, - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port_range_end = AAZIntType( - serialized_name="frontendPortRangeEnd", - flags={"required": True}, - ) - properties.frontend_port_range_start = AAZIntType( - serialized_name="frontendPortRangeStart", - flags={"required": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - inbound_nat_rules = cls._schema_on_200.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - _ShowHelper._build_schema_inbound_nat_rule_read(inbound_nat_rules.Element) - - load_balancing_rules = cls._schema_on_200.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.load_balancing_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.load_balancing_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.disable_outbound_snat = AAZBoolType( - serialized_name="disableOutboundSnat", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - flags={"required": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.load_distribution = AAZStrType( - serialized_name="loadDistribution", - ) - properties.probe = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.probe) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - outbound_nat_rules = cls._schema_on_200.properties.outbound_nat_rules - outbound_nat_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.outbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.outbound_nat_rules.Element.properties - properties.allocated_outbound_ports = AAZIntType( - serialized_name="allocatedOutboundPorts", - ) - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - flags={"required": True}, - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - frontend_ip_configurations = cls._schema_on_200.properties.outbound_nat_rules.Element.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(frontend_ip_configurations.Element) - - probes = cls._schema_on_200.properties.probes - probes.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.probes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.probes.Element.properties - properties.interval_in_seconds = AAZIntType( - serialized_name="intervalInSeconds", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.number_of_probes = AAZIntType( - serialized_name="numberOfProbes", - ) - properties.port = AAZIntType( - flags={"required": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.request_path = AAZStrType( - serialized_name="requestPath", - ) - - load_balancing_rules = cls._schema_on_200.properties.probes.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(load_balancing_rules.Element) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_backend_address_pool_read = None - - @classmethod - def _build_schema_backend_address_pool_read(cls, _schema): - if cls._schema_backend_address_pool_read is not None: - _schema.etag = cls._schema_backend_address_pool_read.etag - _schema.id = cls._schema_backend_address_pool_read.id - _schema.name = cls._schema_backend_address_pool_read.name - _schema.properties = cls._schema_backend_address_pool_read.properties - return - - cls._schema_backend_address_pool_read = _schema_backend_address_pool_read = AAZObjectType() - - backend_address_pool_read = _schema_backend_address_pool_read - backend_address_pool_read.etag = AAZStrType() - backend_address_pool_read.id = AAZStrType() - backend_address_pool_read.name = AAZStrType() - backend_address_pool_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_backend_address_pool_read.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_backend_address_pool_read.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_backend_address_pool_read.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - _schema.etag = cls._schema_backend_address_pool_read.etag - _schema.id = cls._schema_backend_address_pool_read.id - _schema.name = cls._schema_backend_address_pool_read.name - _schema.properties = cls._schema_backend_address_pool_read.properties - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_inbound_nat_rule_read = None - - @classmethod - def _build_schema_inbound_nat_rule_read(cls, _schema): - if cls._schema_inbound_nat_rule_read is not None: - _schema.etag = cls._schema_inbound_nat_rule_read.etag - _schema.id = cls._schema_inbound_nat_rule_read.id - _schema.name = cls._schema_inbound_nat_rule_read.name - _schema.properties = cls._schema_inbound_nat_rule_read.properties - return - - cls._schema_inbound_nat_rule_read = _schema_inbound_nat_rule_read = AAZObjectType() - - inbound_nat_rule_read = _schema_inbound_nat_rule_read - inbound_nat_rule_read.etag = AAZStrType() - inbound_nat_rule_read.id = AAZStrType() - inbound_nat_rule_read.name = AAZStrType() - inbound_nat_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_inbound_nat_rule_read.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_inbound_nat_rule_read.etag - _schema.id = cls._schema_inbound_nat_rule_read.id - _schema.name = cls._schema_inbound_nat_rule_read.name - _schema.properties = cls._schema_inbound_nat_rule_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - cls._build_schema_backend_address_pool_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_inbound_nat_rule_read(load_balancer_inbound_nat_rules.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/__cmd_group.py deleted file mode 100644 index 7d71d8c1f92..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage network interfaces. - - To learn more about network interfaces in Azure, visit https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-network-interface?tabs=network-interface-portal. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/__init__.py deleted file mode 100644 index bee768f7653..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_list.py deleted file mode 100644 index cdf91db918a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_list.py +++ /dev/null @@ -1,1049 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List network interfaces. - - To list network interfaces attached to VMs in VM scale sets use `az vmss nic list` or `az vmss nic list-vm-nics`. - - :example: List all NICs by internal DNS suffix. - az network nic list --query "[?dnsSettings.internalDomainNameSuffix=`{dnsSuffix}`]" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/networkinterfaces", "2017-10-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces", "2017-10-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.NetworkInterfacesList(ctx=self.ctx)() - if condition_1: - self.NetworkInterfacesListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - flags={"read_only": True}, - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - class NetworkInterfacesListAll(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.Network/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - flags={"read_only": True}, - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_show.py deleted file mode 100644 index 94591bd747f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_show.py +++ /dev/null @@ -1,965 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a network interface. - - :example: Get the internal domain name suffix of a NIC. - az network nic show -g MyResourceGroup -n MyNic --query "dnsSettings.internalDomainNameSuffix" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network interface (NIC).", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGet(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 NetworkInterfacesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_update.py deleted file mode 100644 index 1b229be9d16..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nic/_update.py +++ /dev/null @@ -1,2047 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Update(AAZCommand): - """Update a network interface. - - :example: Update a network interface to use a different network security group. - az network nic update -g MyResourceGroup -n MyNic --network-security-group MyNewNsg - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network interface (NIC).", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.accelerated_networking = AAZBoolArg( - options=["--accelerated-networking"], - help="Whether to enable accelerated networking.", - nullable=True, - ) - _args_schema.ip_forwarding = AAZBoolArg( - options=["--ip-forwarding"], - help="Whether to enable IP forwarding.", - nullable=True, - ) - - # define Arg Group "DNS" - - _args_schema = cls._args_schema - _args_schema.dns_servers = AAZListArg( - options=["--dns-servers"], - arg_group="DNS", - help="Space-separated list of DNS server IP addresses. Use null to revert to default Azure servers.", - nullable=True, - ) - _args_schema.internal_dns_name = AAZStrArg( - options=["--internal-dns-name"], - arg_group="DNS", - help="Name of internal DNS label.", - nullable=True, - ) - - dns_servers = cls._args_schema.dns_servers - dns_servers.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "DnsSettings" - - # define Arg Group "Parameters" - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.nsg = AAZObjectArg( - options=["--nsg"], - arg_group="Properties", - help="The reference to the NetworkSecurityGroup resource.", - nullable=True, - ) - - nsg = cls._args_schema.nsg - nsg.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - nsg.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - nsg.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - nsg.default_security_rules = AAZListArg( - options=["default-security-rules"], - help="The default security rules of network security group.", - nullable=True, - ) - nsg.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - nsg.resource_guid = AAZStrArg( - options=["resource-guid"], - help="The resource GUID property of the network security group resource.", - nullable=True, - ) - nsg.security_rules = AAZListArg( - options=["security-rules"], - help="A collection of security rules of the network security group.", - nullable=True, - ) - nsg.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - default_security_rules = cls._args_schema.nsg.default_security_rules - default_security_rules.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_security_rule_update(default_security_rules.Element) - - security_rules = cls._args_schema.nsg.security_rules - security_rules.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.nsg.security_rules.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - _element.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - _element.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - _element.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - _element.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - _element.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _element.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - _element.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - _element.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.", - nullable=True, - ) - _element.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - _element.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - _element.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_schema.nsg.security_rules.Element.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_schema.nsg.security_rules.Element.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_schema.nsg.security_rules.Element.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_schema.nsg.security_rules.Element.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_schema.nsg.security_rules.Element.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_schema.nsg.security_rules.Element.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_schema.nsg.tags - tags.Element = AAZStrArg( - nullable=True, - ) - return cls._args_schema - - _args_application_security_group_update = None - - @classmethod - def _build_args_application_security_group_update(cls, _schema): - if cls._args_application_security_group_update is not None: - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - return - - cls._args_application_security_group_update = AAZObjectArg( - nullable=True, - ) - - application_security_group_update = cls._args_application_security_group_update - application_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_application_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - - _args_network_security_group_update = None - - @classmethod - def _build_args_network_security_group_update(cls, _schema): - if cls._args_network_security_group_update is not None: - _schema.default_security_rules = cls._args_network_security_group_update.default_security_rules - _schema.etag = cls._args_network_security_group_update.etag - _schema.id = cls._args_network_security_group_update.id - _schema.location = cls._args_network_security_group_update.location - _schema.provisioning_state = cls._args_network_security_group_update.provisioning_state - _schema.resource_guid = cls._args_network_security_group_update.resource_guid - _schema.security_rules = cls._args_network_security_group_update.security_rules - _schema.tags = cls._args_network_security_group_update.tags - return - - cls._args_network_security_group_update = AAZObjectArg( - nullable=True, - ) - - network_security_group_update = cls._args_network_security_group_update - network_security_group_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - network_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - network_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - network_security_group_update.default_security_rules = AAZListArg( - options=["default-security-rules"], - help="The default security rules of network security group.", - nullable=True, - ) - network_security_group_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - network_security_group_update.resource_guid = AAZStrArg( - options=["resource-guid"], - help="The resource GUID property of the network security group resource.", - nullable=True, - ) - network_security_group_update.security_rules = AAZListArg( - options=["security-rules"], - help="A collection of security rules of the network security group.", - nullable=True, - ) - network_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - default_security_rules = cls._args_network_security_group_update.default_security_rules - default_security_rules.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_security_rule_update(default_security_rules.Element) - - security_rules = cls._args_network_security_group_update.security_rules - security_rules.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_network_security_group_update.security_rules.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - _element.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - _element.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - _element.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - _element.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - _element.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _element.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - _element.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - _element.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - _element.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - _element.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - _element.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_network_security_group_update.security_rules.Element.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_network_security_group_update.security_rules.Element.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_network_security_group_update.security_rules.Element.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_network_security_group_update.security_rules.Element.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_network_security_group_update.security_rules.Element.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_network_security_group_update.security_rules.Element.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_network_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.default_security_rules = cls._args_network_security_group_update.default_security_rules - _schema.etag = cls._args_network_security_group_update.etag - _schema.id = cls._args_network_security_group_update.id - _schema.location = cls._args_network_security_group_update.location - _schema.provisioning_state = cls._args_network_security_group_update.provisioning_state - _schema.resource_guid = cls._args_network_security_group_update.resource_guid - _schema.security_rules = cls._args_network_security_group_update.security_rules - _schema.tags = cls._args_network_security_group_update.tags - - _args_security_rule_update = None - - @classmethod - def _build_args_security_rule_update(cls, _schema): - if cls._args_security_rule_update is not None: - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - return - - cls._args_security_rule_update = AAZObjectArg( - nullable=True, - ) - - security_rule_update = cls._args_security_rule_update - security_rule_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - security_rule_update.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - security_rule_update.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_update.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - security_rule_update.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - security_rule_update.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - security_rule_update.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - security_rule_update.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - security_rule_update.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_update.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - security_rule_update.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - security_rule_update.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - security_rule_update.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - security_rule_update.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - security_rule_update.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_update.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - - _args_sub_resource_update = None - - @classmethod - def _build_args_sub_resource_update(cls, _schema): - if cls._args_sub_resource_update is not None: - _schema.id = cls._args_sub_resource_update.id - return - - cls._args_sub_resource_update = AAZObjectArg( - nullable=True, - ) - - sub_resource_update = cls._args_sub_resource_update - sub_resource_update.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - - _schema.id = cls._args_sub_resource_update.id - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.NetworkInterfacesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class NetworkInterfacesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - class NetworkInterfacesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_network_interface_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("dnsSettings", AAZObjectType) - properties.set_prop("enableAcceleratedNetworking", AAZBoolType, ".accelerated_networking") - properties.set_prop("enableIPForwarding", AAZBoolType, ".ip_forwarding") - properties.set_prop("networkSecurityGroup", AAZObjectType, ".nsg") - - dns_settings = _builder.get(".properties.dnsSettings") - if dns_settings is not None: - dns_settings.set_prop("dnsServers", AAZListType, ".dns_servers") - dns_settings.set_prop("internalDnsNameLabel", AAZStrType, ".internal_dns_name") - - dns_servers = _builder.get(".properties.dnsSettings.dnsServers") - if dns_servers is not None: - dns_servers.set_elements(AAZStrType, ".") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("etag", AAZStrType, ".etag") - network_security_group.set_prop("id", AAZStrType, ".id") - network_security_group.set_prop("location", AAZStrType, ".location") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - network_security_group.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties.networkSecurityGroup.properties") - if properties is not None: - properties.set_prop("defaultSecurityRules", AAZListType, ".default_security_rules") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("resourceGuid", AAZStrType, ".resource_guid") - properties.set_prop("securityRules", AAZListType, ".security_rules") - - default_security_rules = _builder.get(".properties.networkSecurityGroup.properties.defaultSecurityRules") - if default_security_rules is not None: - _UpdateHelper._build_schema_security_rule_update(default_security_rules.set_elements(AAZObjectType, ".")) - - security_rules = _builder.get(".properties.networkSecurityGroup.properties.securityRules") - if security_rules is not None: - security_rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.networkSecurityGroup.properties.securityRules[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - _UpdateHelper._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - _UpdateHelper._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - tags = _builder.get(".properties.networkSecurityGroup.tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_application_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_network_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("defaultSecurityRules", AAZListType, ".default_security_rules") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("resourceGuid", AAZStrType, ".resource_guid") - properties.set_prop("securityRules", AAZListType, ".security_rules") - - default_security_rules = _builder.get(".properties.defaultSecurityRules") - if default_security_rules is not None: - cls._build_schema_security_rule_update(default_security_rules.set_elements(AAZObjectType, ".")) - - security_rules = _builder.get(".properties.securityRules") - if security_rules is not None: - security_rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.securityRules[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.securityRules[].properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.securityRules[].properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.securityRules[].properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.securityRules[].properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.securityRules[].properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.securityRules[].properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.securityRules[].properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_sub_resource_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/__cmd_group.py deleted file mode 100644 index 22ad607bc90..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage Azure Network Security Groups (NSGs). - - You can control network traffic to resources in a virtual network using a network security group. A network security group contains a list of security rules that allow or deny inbound or outbound network traffic based on source or destination IP addresses, Application Security Groups, ports, and protocols. For more information visit https://learn.microsoft.com/azure/virtual-network/virtual-networks-create-nsg-arm-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/__init__.py deleted file mode 100644 index 4fbda4a6e7a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/_create.py deleted file mode 100644 index 05596df4e8f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/_create.py +++ /dev/null @@ -1,1230 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a network security group. - - :example: Create an NSG in a resource group within a region with tags. - az network nsg create -g MyResourceGroup -n MyNsg --tags foo=bar - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - help="Space-separated tags: key[=value] [key[=value] ...].", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Parameters" - - # define Arg Group "Properties" - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - _args_security_rule_create = None - - @classmethod - def _build_args_security_rule_create(cls, _schema): - if cls._args_security_rule_create is not None: - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - return - - cls._args_security_rule_create = AAZObjectArg() - - security_rule_create = cls._args_security_rule_create - security_rule_create.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - ) - security_rule_create.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - ) - security_rule_create.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_create.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - ) - security_rule_create.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - security_rule_create.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - ) - security_rule_create.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - ) - security_rule_create.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - ) - security_rule_create.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_create.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - security_rule_create.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_create.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - ) - security_rule_create.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - ) - security_rule_create.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - ) - security_rule_create.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - ) - security_rule_create.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - ) - - destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_create.source_port_ranges - source_port_ranges.Element = AAZStrArg() - - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - yield self.NetworkSecurityGroupsCreateOrUpdate(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 NetworkSecurityGroupsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - 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("location", AAZStrType, ".location") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_network_security_group_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/_show.py deleted file mode 100644 index f395c7c8c82..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/_show.py +++ /dev/null @@ -1,945 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get information about a network security group. - - :example: Get basic information about an NSG. - az network nsg show -g MyResourceGroup -n MyNsg - - :example: Get the default security rules of an NSG and format the output as a table. - az network nsg show -g MyResourceGroup -n MyNsg --query "defaultSecurityRules[]" -o table - - :example: Get all default NSG rules with "Allow" access and format the output as a table. - az network nsg show -g MyResourceGroup -n MyNsg --query "defaultSecurityRules[?access=='Allow']" -o table - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkSecurityGroupsGet(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 NetworkSecurityGroupsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_security_group_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/__cmd_group.py deleted file mode 100644 index 6e93e97c0d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/__cmd_group.py +++ /dev/null @@ -1,20 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage network security group rules. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/__init__.py deleted file mode 100644 index a6df9f5a835..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/_create.py deleted file mode 100644 index 3bdca191c8d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/nsg/rule/_create.py +++ /dev/null @@ -1,541 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a network security group rule. - - :example: Create a basic "Allow" NSG rule with the highest priority. - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule --priority 100 - - :example: Create a "Deny" rule over TCP for a specific IP address range with the lowest priority. - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule --priority 4096 --source-address-prefixes 208.130.28.0/24 --source-port-ranges 80 --destination-address-prefixes '*' --destination-port-ranges 80 8080 --access Deny --protocol Tcp --description "Deny from specific IP address ranges on 80 and 8080." - - :example: Create a security rule using service tags (https://aka.ms/servicetags). - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRuleWithTags --priority 400 --source-address-prefixes VirtualNetwork --destination-address-prefixes Storage --destination-port-ranges '*' --direction Outbound --access Allow --protocol Tcp --description "Allow VirtualNetwork to Storage." - - :example: Create a security rule using application security groups (https://aka.ms/applicationsecuritygroups). - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRuleWithAsg --priority 500 --source-address-prefixes Internet --destination-port-ranges 80 8080 --destination-asgs Web --access Allow --protocol Tcp --description "Allow Internet to Web ASG on ports 80,8080." - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}/securityrules/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.nsg_name = AAZStrArg( - options=["--nsg-name"], - help="Name of the network security group.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group rule.", - required=True, - ) - _args_schema.access = AAZStrArg( - options=["--access"], - help="Network traffic is allowed or denied.", - default="Allow", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _args_schema.description = AAZStrArg( - options=["--description"], - help="Description for this rule. Restricted to 140 chars.", - ) - _args_schema.direction = AAZStrArg( - options=["--direction"], - help="Direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.", - default="Inbound", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _args_schema.priority = AAZIntArg( - options=["--priority"], - help="Priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - _args_schema.protocol = AAZStrArg( - options=["--protocol"], - help="Network protocol this rule applies to.", - default="*", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - - # define Arg Group "Destination" - - _args_schema = cls._args_schema - _args_schema.destination_address_prefix = AAZStrArg( - options=["--destination-address-prefix"], - arg_group="Destination", - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - _args_schema.destination_address_prefixes = AAZListArg( - options=["--destination-address-prefixes"], - arg_group="Destination", - help="Space-separated list of CIDR prefixes or IP ranges. Alternatively, specify ONE of 'VirtualNetwork', 'AzureLoadBalancer', 'Internet' or '*' to match all IPs. Besides, it also supports all available Service Tags like 'ApiManagement', 'SqlManagement', 'AzureMonitor', etc.", - default=["*"], - ) - _args_schema.destination_application_security_groups = AAZListArg( - options=["--destination-application-security-groups"], - arg_group="Destination", - help="Application security group specified as destination.", - ) - _args_schema.destination_port_range = AAZStrArg( - options=["--destination-port-range"], - arg_group="Destination", - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - ) - _args_schema.destination_port_ranges = AAZListArg( - options=["--destination-port-ranges"], - arg_group="Destination", - help="Space-separated list of ports or port ranges between 0-65535. Use '*' to match all ports.", - default=["80"], - ) - - destination_address_prefixes = cls._args_schema.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_schema.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_schema.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - # define Arg Group "Properties" - - # define Arg Group "SecurityRuleParameters" - - # define Arg Group "Source" - - _args_schema = cls._args_schema - _args_schema.source_address_prefix = AAZStrArg( - options=["--source-address-prefix"], - arg_group="Source", - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.", - ) - _args_schema.source_address_prefixes = AAZListArg( - options=["--source-address-prefixes"], - arg_group="Source", - help="Space-separated list of CIDR prefixes or IP ranges. Alternatively, specify ONE of 'VirtualNetwork', 'AzureLoadBalancer', 'Internet' or '*' to match all IPs. Besides, it also supports all available Service Tags like 'ApiManagement', 'SqlManagement', 'AzureMonitor', etc.", - default=["*"], - ) - _args_schema.source_application_security_groups = AAZListArg( - options=["--source-application-security-groups"], - arg_group="Source", - help="Application security group specified as source.", - ) - _args_schema.source_port_range = AAZStrArg( - options=["--source-port-range"], - arg_group="Source", - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - ) - _args_schema.source_port_ranges = AAZListArg( - options=["--source-port-ranges"], - arg_group="Source", - help="Space-separated list of ports or port ranges between 0-65535. Use '*' to match all ports.", - default=["*"], - ) - - source_address_prefixes = cls._args_schema.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_schema.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_schema.source_port_ranges - source_port_ranges.Element = AAZStrArg() - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - def _execute_operations(self): - self.pre_operations() - yield self.SecurityRulesCreateOrUpdate(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 SecurityRulesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.nsg_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "securityRuleName", self.ctx.args.name, - required=True, - ), - **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", "2017-10-01", - 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") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - _CreateHelper._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - _CreateHelper._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.etag = AAZStrType() - _schema_on_200_201.id = AAZStrType() - _schema_on_200_201.name = AAZStrType() - _schema_on_200_201.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = cls._schema_on_200_201.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = cls._schema_on_200_201.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - _CreateHelper._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = cls._schema_on_200_201.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = cls._schema_on_200_201.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = cls._schema_on_200_201.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - _CreateHelper._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = cls._schema_on_200_201.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/__cmd_group.py deleted file mode 100644 index 2557faf7887..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage public IP addresses. - - To learn more about public IP addresses visit https://learn.microsoft.com/azure/virtual-network/virtual-network-public-ip-address. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/__init__.py deleted file mode 100644 index 2df85698253..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/_list.py deleted file mode 100644 index 0c48b502a54..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/_list.py +++ /dev/null @@ -1,1278 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List public IP addresses. - - :example: List all public IPs in a subscription. - az network public-ip list - - :example: List all public IPs in a resource group. - az network public-ip list -g MyResourceGroup - - :example: List all public IPs of a domain name label. - az network public-ip list -g MyResourceGroup --query "[?dnsSettings.domainNameLabel=='MyLabel']" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/publicipaddresses", "2017-10-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/publicipaddresses", "2017-10-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.PublicIPAddressesList(ctx=self.ctx)() - if condition_1: - self.PublicIPAddressesListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class PublicIPAddressesList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - class PublicIPAddressesListAll(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.Network/publicIPAddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType( - flags={"read_only": True} - ) - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.location = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - application_security_group_read.tags = AAZDictType( - flags={"read_only": True}, - ) - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType( - flags={"read_only": True} - ) - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.id = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.name = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - flags={"read_only": True}, - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType( - flags={"read_only": True} - ) - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.id = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - flags={"read_only": True}, - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - flags={"read_only": True}, - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - flags={"read_only": True}, - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - flags={"read_only": True}, - ) - properties.primary = AAZBoolType( - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - flags={"read_only": True}, - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - flags={"read_only": True}, - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - flags={"read_only": True}, - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType( - flags={"read_only": True}, - ) - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - flags={"read_only": True}, - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - flags={"read_only": True}, - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - flags={"read_only": True}, - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - flags={"read_only": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - flags={"read_only": True}, - ) - properties.protocol = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType( - flags={"read_only": True} - ) - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.location = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - network_security_group_read.tags = AAZDictType( - flags={"read_only": True}, - ) - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - flags={"read_only": True}, - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - flags={"read_only": True}, - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - _element.tags = AAZDictType( - flags={"read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - flags={"read_only": True}, - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - flags={"read_only": True}, - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - flags={"read_only": True}, - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - flags={"read_only": True}, - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - flags={"read_only": True}, - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - flags={"read_only": True}, - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - flags={"read_only": True}, - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - flags={"read_only": True}, - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType( - flags={"read_only": True}, - ) - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType( - flags={"read_only": True}, - ) - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType( - flags={"read_only": True} - ) - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.id = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.name = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.description = AAZStrType( - flags={"read_only": True}, - ) - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"read_only": True}, - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - flags={"read_only": True}, - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - flags={"read_only": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - flags={"read_only": True}, - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - flags={"read_only": True}, - ) - properties.direction = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.priority = AAZIntType( - flags={"read_only": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"read_only": True}, - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - flags={"read_only": True}, - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - flags={"read_only": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - flags={"read_only": True}, - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - flags={"read_only": True}, - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType( - flags={"read_only": True}, - ) - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType( - flags={"read_only": True}, - ) - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType( - flags={"read_only": True}, - ) - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType( - flags={"read_only": True} - ) - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType( - flags={"read_only": True}, - ) - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType( - flags={"read_only": True} - ) - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.id = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.name = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - flags={"read_only": True}, - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - flags={"read_only": True}, - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - flags={"read_only": True}, - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - flags={"read_only": True}, - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType( - flags={"read_only": True}, - ) - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType( - flags={"read_only": True}, - ) - route_table.id = AAZStrType( - flags={"read_only": True}, - ) - route_table.location = AAZStrType( - flags={"read_only": True}, - ) - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - route_table.tags = AAZDictType( - flags={"read_only": True}, - ) - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.routes = AAZListType( - flags={"read_only": True}, - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - flags={"read_only": True}, - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - flags={"read_only": True}, - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True, "read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType( - flags={"read_only": True}, - ) - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - _element.service = AAZStrType( - flags={"read_only": True}, - ) - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/_show.py deleted file mode 100644 index 175a59c1235..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/public_ip/_show.py +++ /dev/null @@ -1,1195 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a public IP address. - - :example: Get information about a public IP resource. - az network public-ip show -g MyResourceGroup -n MyIp - - :example: Get the FQDN and IP address of a public IP resource. - az network public-ip show -g MyResourceGroup -n MyIp --query "{fqdn: dnsSettings.fqdn,address: ipAddress}" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/publicipaddresses/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the public IP address.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PublicIPAddressesGet(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 PublicIPAddressesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "publicIpAddressName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_public_ip_address_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType( - flags={"read_only": True} - ) - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.location = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - application_security_group_read.tags = AAZDictType( - flags={"read_only": True}, - ) - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType( - flags={"read_only": True} - ) - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.id = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.name = AAZStrType( - flags={"read_only": True}, - ) - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - flags={"read_only": True}, - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType( - flags={"read_only": True} - ) - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.id = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - flags={"read_only": True}, - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - flags={"read_only": True}, - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - flags={"read_only": True}, - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - flags={"read_only": True}, - ) - properties.primary = AAZBoolType( - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - flags={"read_only": True}, - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - flags={"read_only": True}, - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - flags={"read_only": True}, - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType( - flags={"read_only": True}, - ) - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - flags={"read_only": True}, - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - flags={"read_only": True}, - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - flags={"read_only": True}, - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - flags={"read_only": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - flags={"read_only": True}, - ) - properties.protocol = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType( - flags={"read_only": True} - ) - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.location = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - network_security_group_read.tags = AAZDictType( - flags={"read_only": True}, - ) - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - flags={"read_only": True}, - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - flags={"read_only": True}, - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - _element.tags = AAZDictType( - flags={"read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - flags={"read_only": True}, - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - flags={"read_only": True}, - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - flags={"read_only": True}, - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - flags={"read_only": True}, - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - flags={"read_only": True}, - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - flags={"read_only": True}, - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - flags={"read_only": True}, - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - flags={"read_only": True}, - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - flags={"read_only": True}, - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType( - flags={"read_only": True}, - ) - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType( - flags={"read_only": True}, - ) - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - flags={"read_only": True}, - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType( - flags={"read_only": True} - ) - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.id = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.name = AAZStrType( - flags={"read_only": True}, - ) - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.description = AAZStrType( - flags={"read_only": True}, - ) - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"read_only": True}, - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - flags={"read_only": True}, - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - flags={"read_only": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - flags={"read_only": True}, - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - flags={"read_only": True}, - ) - properties.direction = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.priority = AAZIntType( - flags={"read_only": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True, "read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"read_only": True}, - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - flags={"read_only": True}, - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - flags={"read_only": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - flags={"read_only": True}, - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - flags={"read_only": True}, - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType( - flags={"read_only": True}, - ) - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType( - flags={"read_only": True}, - ) - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType( - flags={"read_only": True}, - ) - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType( - flags={"read_only": True} - ) - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType( - flags={"read_only": True}, - ) - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType( - flags={"read_only": True} - ) - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.id = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.name = AAZStrType( - flags={"read_only": True}, - ) - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - flags={"read_only": True}, - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - flags={"read_only": True}, - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - flags={"read_only": True}, - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - flags={"read_only": True}, - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType( - flags={"read_only": True}, - ) - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType( - flags={"read_only": True}, - ) - route_table.id = AAZStrType( - flags={"read_only": True}, - ) - route_table.location = AAZStrType( - flags={"read_only": True}, - ) - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - route_table.tags = AAZDictType( - flags={"read_only": True}, - ) - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.routes = AAZListType( - flags={"read_only": True}, - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True, "read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - flags={"read_only": True}, - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - flags={"read_only": True}, - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True, "read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType( - flags={"read_only": True}, - ) - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType( - flags={"read_only": True}, - ) - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType( - flags={"read_only": True}, - ) - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType( - flags={"read_only": True}, - ) - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - _element.service = AAZStrType( - flags={"read_only": True}, - ) - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType( - flags={"read_only": True}, - ) - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/__cmd_group.py deleted file mode 100644 index 73d2004eb91..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Check if a private IP address is available for use within a virtual network. - - To learn more about Virtual Networks visit https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-network. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/__init__.py deleted file mode 100644 index d63ae5a6fc9..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/_list.py deleted file mode 100644 index 10af87394a2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/_list.py +++ /dev/null @@ -1,1231 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List virtual networks. - - :example: List all virtual networks in a subscription. - az network vnet list - - :example: List all virtual networks in a resource group. - az network vnet list -g MyResourceGroup - - :example: List virtual networks in a subscription which specify a certain address prefix. - az network vnet list --query "[?contains(addressSpace.addressPrefixes, '10.0.0.0/16')]" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/virtualnetworks", "2017-10-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks", "2017-10-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.VirtualNetworksList(ctx=self.ctx)() - if condition_1: - self.VirtualNetworksListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualNetworksList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.address_space = AAZObjectType( - serialized_name="addressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.address_space) - properties.dhcp_options = AAZObjectType( - serialized_name="dhcpOptions", - ) - properties.enable_ddos_protection = AAZBoolType( - serialized_name="enableDdosProtection", - ) - properties.enable_vm_protection = AAZBoolType( - serialized_name="enableVmProtection", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.subnets = AAZListType() - properties.virtual_network_peerings = AAZListType( - serialized_name="virtualNetworkPeerings", - ) - - dhcp_options = cls._schema_on_200.value.Element.properties.dhcp_options - dhcp_options.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.dhcp_options.dns_servers - dns_servers.Element = AAZStrType() - - subnets = cls._schema_on_200.value.Element.properties.subnets - subnets.Element = AAZObjectType() - _ListHelper._build_schema_subnet_read(subnets.Element) - - virtual_network_peerings = cls._schema_on_200.value.Element.properties.virtual_network_peerings - virtual_network_peerings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element.properties - properties.allow_forwarded_traffic = AAZBoolType( - serialized_name="allowForwardedTraffic", - ) - properties.allow_gateway_transit = AAZBoolType( - serialized_name="allowGatewayTransit", - ) - properties.allow_virtual_network_access = AAZBoolType( - serialized_name="allowVirtualNetworkAccess", - ) - properties.peering_state = AAZStrType( - serialized_name="peeringState", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.remote_address_space = AAZObjectType( - serialized_name="remoteAddressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.remote_address_space) - properties.remote_virtual_network = AAZObjectType( - serialized_name="remoteVirtualNetwork", - ) - _ListHelper._build_schema_sub_resource_read(properties.remote_virtual_network) - properties.use_remote_gateways = AAZBoolType( - serialized_name="useRemoteGateways", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class VirtualNetworksListAll(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.Network/virtualNetworks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.address_space = AAZObjectType( - serialized_name="addressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.address_space) - properties.dhcp_options = AAZObjectType( - serialized_name="dhcpOptions", - ) - properties.enable_ddos_protection = AAZBoolType( - serialized_name="enableDdosProtection", - ) - properties.enable_vm_protection = AAZBoolType( - serialized_name="enableVmProtection", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.subnets = AAZListType() - properties.virtual_network_peerings = AAZListType( - serialized_name="virtualNetworkPeerings", - ) - - dhcp_options = cls._schema_on_200.value.Element.properties.dhcp_options - dhcp_options.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.dhcp_options.dns_servers - dns_servers.Element = AAZStrType() - - subnets = cls._schema_on_200.value.Element.properties.subnets - subnets.Element = AAZObjectType() - _ListHelper._build_schema_subnet_read(subnets.Element) - - virtual_network_peerings = cls._schema_on_200.value.Element.properties.virtual_network_peerings - virtual_network_peerings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element.properties - properties.allow_forwarded_traffic = AAZBoolType( - serialized_name="allowForwardedTraffic", - ) - properties.allow_gateway_transit = AAZBoolType( - serialized_name="allowGatewayTransit", - ) - properties.allow_virtual_network_access = AAZBoolType( - serialized_name="allowVirtualNetworkAccess", - ) - properties.peering_state = AAZStrType( - serialized_name="peeringState", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.remote_address_space = AAZObjectType( - serialized_name="remoteAddressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.remote_address_space) - properties.remote_virtual_network = AAZObjectType( - serialized_name="remoteVirtualNetwork", - ) - _ListHelper._build_schema_sub_resource_read(properties.remote_virtual_network) - properties.use_remote_gateways = AAZBoolType( - serialized_name="useRemoteGateways", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_address_space_read = None - - @classmethod - def _build_schema_address_space_read(cls, _schema): - if cls._schema_address_space_read is not None: - _schema.address_prefixes = cls._schema_address_space_read.address_prefixes - return - - cls._schema_address_space_read = _schema_address_space_read = AAZObjectType() - - address_space_read = _schema_address_space_read - address_space_read.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - - address_prefixes = _schema_address_space_read.address_prefixes - address_prefixes.Element = AAZStrType() - - _schema.address_prefixes = cls._schema_address_space_read.address_prefixes - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/__cmd_group.py deleted file mode 100644 index 748734c3253..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage subnets in an Azure Virtual Network. - - To learn more about subnets visit https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-subnet. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/__init__.py deleted file mode 100644 index 1fcc89bcaa3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_create.py deleted file mode 100644 index 9e9b3d755fe..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_create.py +++ /dev/null @@ -1,1301 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a subnet and associate an existing NSG and route table. - - :example: Create new subnet attached to an NSG with a custom route table. - az network vnet subnet create -g MyResourceGroup --vnet-name MyVnet -n MySubnet --address-prefixes 10.0.0.0/24 --network-security-group MyNsg --route-table MyRouteTable - - :example: Create new subnet attached to a NAT gateway. - az network vnet subnet create -n MySubnet --vnet-name MyVnet -g MyResourceGroup --nat-gateway MyNatGateway --address-prefixes "10.0.0.0/21" - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - ) - _args_schema.address_prefix = AAZStrArg( - options=["--address-prefix"], - help="The address prefix for the subnet.", - ) - _args_schema.network_security_group = AAZResourceIdArg( - options=["--nsg", "--network-security-group"], - help="Name or ID of a network security group (NSG).", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - _args_schema.route_table = AAZResourceIdArg( - options=["--route-table"], - help="Name or ID of a route table to associate with the subnet.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", - ), - ) - _args_schema.endpoints = AAZListArg( - options=["--endpoints"], - help="An array of service endpoints.", - ) - - endpoints = cls._args_schema.endpoints - endpoints.Element = AAZObjectArg() - - _element = cls._args_schema.endpoints.Element - _element.locations = AAZListArg( - options=["locations"], - help="A list of locations.", - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource.", - ) - _element.service = AAZStrArg( - options=["service"], - help="The type of the endpoint service.", - ) - - locations = cls._args_schema.endpoints.Element.locations - locations.Element = AAZStrArg() - - # define Arg Group "NetworkSecurityGroup" - - # define Arg Group "Properties" - - # define Arg Group "RouteTable" - - # define Arg Group "SubnetParameters" - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - _args_security_rule_create = None - - @classmethod - def _build_args_security_rule_create(cls, _schema): - if cls._args_security_rule_create is not None: - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - return - - cls._args_security_rule_create = AAZObjectArg() - - security_rule_create = cls._args_security_rule_create - security_rule_create.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - ) - security_rule_create.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - ) - security_rule_create.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_create.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - ) - security_rule_create.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - security_rule_create.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - ) - security_rule_create.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - ) - security_rule_create.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - ) - security_rule_create.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_create.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - security_rule_create.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_create.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - ) - security_rule_create.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - ) - security_rule_create.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - ) - security_rule_create.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - ) - security_rule_create.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - ) - - destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_create.source_port_ranges - source_port_ranges.Element = AAZStrArg() - - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - yield self.SubnetsCreateOrUpdate(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 SubnetsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-10-01", - 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") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefix", AAZStrType, ".address_prefix") - properties.set_prop("networkSecurityGroup", AAZObjectType) - properties.set_prop("routeTable", AAZObjectType) - properties.set_prop("serviceEndpoints", AAZListType, ".endpoints") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("id", AAZStrType, ".network_security_group") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - route_table = _builder.get(".properties.routeTable") - if route_table is not None: - route_table.set_prop("id", AAZStrType, ".route_table") - route_table.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - service_endpoints = _builder.get(".properties.serviceEndpoints") - if service_endpoints is not None: - service_endpoints.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpoints[]") - if _elements is not None: - _elements.set_prop("locations", AAZListType, ".locations") - _elements.set_prop("provisioningState", AAZStrType, ".provisioning_state") - _elements.set_prop("service", AAZStrType, ".service") - - locations = _builder.get(".properties.serviceEndpoints[].locations") - if locations is not None: - locations.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_subnet_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_show.py deleted file mode 100644 index 4814783dfd0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_show.py +++ /dev/null @@ -1,949 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Show details of a subnet. - - :example: Show the details of a subnet associated with a virtual network. - az network vnet subnet show -g MyResourceGroup -n MySubnet --vnet-name MyVNet - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2017-10-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - id_part="child_name_1", - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - id_part="name", - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SubnetsGet(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 SubnetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_subnet_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_update.py deleted file mode 100644 index 52329fbf647..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/network/vnet/subnet/_update.py +++ /dev/null @@ -1,1479 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Update(AAZCommand): - """Update a subnet. - - :example: Associate a network security group to a subnet. - az network vnet subnet update -g MyResourceGroup -n MySubnet --vnet-name MyVNet --network-security-group MyNsg - - :example: Update subnet with NAT gateway. - az network vnet subnet update -n MySubnet --vnet-name MyVnet -g MyResourceGroup --nat-gateway MyNatGateway --address-prefixes "10.0.0.0/21" - - :example: Disable the private endpoint network policies - az network vnet subnet update -n MySubnet --vnet-name MyVnet -g MyResourceGroup --disable-private-endpoint-network-policies - - :example: Detach a network security group in a subnet. - az network vnet subnet update -g MyResourceGroup --vnet-name MyVNet -n MySubnet --nsg null - """ - - _aaz_info = { - "version": "2017-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2017-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - id_part="child_name_1", - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - id_part="name", - ) - _args_schema.address_prefix = AAZStrArg( - options=["--address-prefix"], - help="The address prefix for the subnet.", - nullable=True, - ) - _args_schema.network_security_group = AAZResourceIdArg( - options=["--nsg", "--network-security-group"], - help="Name or ID of a network security group (NSG). Use null to detach it.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - _args_schema.route_table = AAZResourceIdArg( - options=["--route-table"], - help="Name or ID of a route table to associate with the subnet. Use null to detach it.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", - ), - ) - _args_schema.endpoints = AAZListArg( - options=["--endpoints"], - help="An array of service endpoints.", - nullable=True, - ) - - endpoints = cls._args_schema.endpoints - endpoints.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.endpoints.Element - _element.locations = AAZListArg( - options=["locations"], - help="A list of locations.", - nullable=True, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource.", - nullable=True, - ) - _element.service = AAZStrArg( - options=["service"], - help="The type of the endpoint service.", - nullable=True, - ) - - locations = cls._args_schema.endpoints.Element.locations - locations.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "NetworkSecurityGroup" - - # define Arg Group "Properties" - - # define Arg Group "RouteTable" - - # define Arg Group "SubnetParameters" - return cls._args_schema - - _args_application_security_group_update = None - - @classmethod - def _build_args_application_security_group_update(cls, _schema): - if cls._args_application_security_group_update is not None: - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - return - - cls._args_application_security_group_update = AAZObjectArg( - nullable=True, - ) - - application_security_group_update = cls._args_application_security_group_update - application_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_application_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - - _args_security_rule_update = None - - @classmethod - def _build_args_security_rule_update(cls, _schema): - if cls._args_security_rule_update is not None: - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - return - - cls._args_security_rule_update = AAZObjectArg( - nullable=True, - ) - - security_rule_update = cls._args_security_rule_update - security_rule_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - security_rule_update.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - security_rule_update.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_update.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - security_rule_update.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - security_rule_update.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - security_rule_update.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - security_rule_update.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - security_rule_update.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_update.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - security_rule_update.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - security_rule_update.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - security_rule_update.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - security_rule_update.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - security_rule_update.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_update.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - self.SubnetsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.SubnetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class SubnetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_subnet_read(cls._schema_on_200) - - return cls._schema_on_200 - - class SubnetsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-10-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_subnet_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefix", AAZStrType, ".address_prefix") - properties.set_prop("networkSecurityGroup", AAZObjectType) - properties.set_prop("routeTable", AAZObjectType) - properties.set_prop("serviceEndpoints", AAZListType, ".endpoints") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("id", AAZStrType, ".network_security_group") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - route_table = _builder.get(".properties.routeTable") - if route_table is not None: - route_table.set_prop("id", AAZStrType, ".route_table") - route_table.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - service_endpoints = _builder.get(".properties.serviceEndpoints") - if service_endpoints is not None: - service_endpoints.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpoints[]") - if _elements is not None: - _elements.set_prop("locations", AAZListType, ".locations") - _elements.set_prop("provisioningState", AAZStrType, ".provisioning_state") - _elements.set_prop("service", AAZStrType, ".service") - - locations = _builder.get(".properties.serviceEndpoints[].locations") - if locations is not None: - locations.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_application_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = _schema_network_security_group_read.properties.network_interfaces.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties.network_interfaces.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_security_group_read.properties.network_interfaces.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_security_group_read.properties.network_interfaces.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_security_group_read.properties.network_interfaces.Element.tags - tags.Element = AAZStrType() - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/__cmd_group.py deleted file mode 100644 index f4c2f2afe19..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot", -) -class __CMDGroup(AAZCommandGroup): - """Manage point-in-time copies of managed disks, native blobs, or other snapshots. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/__init__.py deleted file mode 100644 index 59700973595..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._grant_access import * -from ._list import * -from ._revoke_access import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_create.py deleted file mode 100644 index 02df23d780e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_create.py +++ /dev/null @@ -1,541 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot create", -) -class Create(AAZCommand): - """Create a snapshot. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.creation_data = AAZObjectArg( - options=["--creation-data"], - arg_group="Properties", - help="Disk source information. CreationData information cannot be changed after the disk has been created.", - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["--disk-size-gb"], - arg_group="Properties", - help="If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.", - ) - _args_schema.encryption_settings = AAZObjectArg( - options=["--encryption-settings"], - arg_group="Properties", - help="Encryption settings for disk or snapshot", - ) - _args_schema.os_type = AAZStrArg( - options=["--os-type"], - arg_group="Properties", - help="The Operating System type.", - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - - creation_data = cls._args_schema.creation_data - creation_data.create_option = AAZStrArg( - options=["create-option"], - help="This enumerates the possible sources of a disk's creation.", - required=True, - enum={"Attach": "Attach", "Copy": "Copy", "Empty": "Empty", "FromImage": "FromImage", "Import": "Import"}, - ) - creation_data.image_reference = AAZObjectArg( - options=["image-reference"], - help="Disk source information for PIR or user images.", - ) - creation_data.source_resource_id = AAZStrArg( - options=["source-resource-id"], - help="If createOption is Copy, this is the ARM id of the source snapshot or disk.", - ) - creation_data.source_uri = AAZStrArg( - options=["source-uri"], - help="If createOption is Import, this is the URI of a blob to be imported into a managed disk.", - ) - creation_data.storage_account_id = AAZStrArg( - options=["storage-account-id"], - help="Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk.", - ) - - image_reference = cls._args_schema.creation_data.image_reference - image_reference.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository or user image reference.", - ) - image_reference.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - ) - - encryption_settings = cls._args_schema.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectArg( - options=["disk-encryption-key"], - help="Key Vault Secret Url and vault id of the disk encryption key", - ) - encryption_settings.enabled = AAZBoolArg( - options=["enabled"], - help="Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.", - ) - encryption_settings.key_encryption_key = AAZObjectArg( - options=["key-encryption-key"], - help="Key Vault Key Url and vault id of the key encryption key", - ) - - disk_encryption_key = cls._args_schema.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrArg( - options=["secret-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - disk_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(disk_encryption_key.source_vault) - - key_encryption_key = cls._args_schema.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrArg( - options=["key-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - key_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(key_encryption_key.source_vault) - - # define Arg Group "Snapshot" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Snapshot", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - arg_group="Snapshot", - help="The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot", - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Snapshot", - help="Resource tags", - ) - - sku = cls._args_schema.sku - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - _args_source_vault_create = None - - @classmethod - def _build_args_source_vault_create(cls, _schema): - if cls._args_source_vault_create is not None: - _schema.id = cls._args_source_vault_create.id - return - - cls._args_source_vault_create = AAZObjectArg() - - source_vault_create = cls._args_source_vault_create - source_vault_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_source_vault_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsCreateOrUpdate(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 SnapshotsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("creationData", AAZObjectType, ".creation_data", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryptionSettings", AAZObjectType, ".encryption_settings") - properties.set_prop("osType", AAZStrType, ".os_type") - - creation_data = _builder.get(".properties.creationData") - if creation_data is not None: - creation_data.set_prop("createOption", AAZStrType, ".create_option", typ_kwargs={"flags": {"required": True}}) - creation_data.set_prop("imageReference", AAZObjectType, ".image_reference") - creation_data.set_prop("sourceResourceId", AAZStrType, ".source_resource_id") - creation_data.set_prop("sourceUri", AAZStrType, ".source_uri") - creation_data.set_prop("storageAccountId", AAZStrType, ".storage_account_id") - - image_reference = _builder.get(".properties.creationData.imageReference") - if image_reference is not None: - image_reference.set_prop("id", AAZStrType, ".id") - image_reference.set_prop("lun", AAZIntType, ".lun") - - encryption_settings = _builder.get(".properties.encryptionSettings") - if encryption_settings is not None: - encryption_settings.set_prop("diskEncryptionKey", AAZObjectType, ".disk_encryption_key") - encryption_settings.set_prop("enabled", AAZBoolType, ".enabled") - encryption_settings.set_prop("keyEncryptionKey", AAZObjectType, ".key_encryption_key") - - disk_encryption_key = _builder.get(".properties.encryptionSettings.diskEncryptionKey") - if disk_encryption_key is not None: - disk_encryption_key.set_prop("secretUrl", AAZStrType, ".secret_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(disk_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - key_encryption_key = _builder.get(".properties.encryptionSettings.keyEncryptionKey") - if key_encryption_key is not None: - key_encryption_key.set_prop("keyUrl", AAZStrType, ".key_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(key_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".name") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - 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() - _CreateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_source_vault_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_snapshot_read = None - - @classmethod - def _build_schema_snapshot_read(cls, _schema): - if cls._schema_snapshot_read is not None: - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - return - - cls._schema_snapshot_read = _schema_snapshot_read = AAZObjectType() - - snapshot_read = _schema_snapshot_read - snapshot_read.id = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.location = AAZStrType( - flags={"required": True}, - ) - snapshot_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - snapshot_read.name = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - snapshot_read.sku = AAZObjectType() - snapshot_read.tags = AAZDictType() - snapshot_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_snapshot_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = _schema_snapshot_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = _schema_snapshot_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = _schema_snapshot_read.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_snapshot_read.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_snapshot_read.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_snapshot_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_snapshot_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_delete.py deleted file mode 100644 index 50651317a7c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_delete.py +++ /dev/null @@ -1,226 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot delete", -) -class Delete(AAZCommand): - """Delete a snapshot. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsDelete(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 SnapshotsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_grant_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_grant_access.py deleted file mode 100644 index 19c88fae2b1..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_grant_access.py +++ /dev/null @@ -1,231 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot grant-access", -) -class GrantAccess(AAZCommand): - """Grant read access to a snapshot. - - :example: Grant read access to a snapshot. - az snapshot grant-access --duration-in-seconds 3600 --name MySnapshot --resource-group MyResourceGroup - - :example: Grant read access to a snapshot with specifying the file format. - az snapshot grant-access --duration-in-seconds 3600 --name MySnapshot --resource-group MyResourceGroup --file-format VHDX - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}/begingetaccess", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - - # define Arg Group "GrantAccessData" - - _args_schema = cls._args_schema - _args_schema.access_level = AAZStrArg( - options=["--access", "--access-level"], - arg_group="GrantAccessData", - help="Access level.", - required=True, - default="Read", - enum={"Read": "Read"}, - ) - _args_schema.duration_in_seconds = AAZIntArg( - options=["--duration-in-seconds"], - arg_group="GrantAccessData", - help="Time duration in seconds until the SAS access expires.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsGrantAccess(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 SnapshotsGrantAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - 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("access", AAZStrType, ".access_level", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("durationInSeconds", AAZIntType, ".duration_in_seconds", 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.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties - properties.output = AAZObjectType( - flags={"client_flatten": True}, - ) - - output = cls._schema_on_200.properties.output - output.access_sas = AAZStrType( - serialized_name="accessSAS", - flags={"read_only": True}, - ) - - return cls._schema_on_200 - - -class _GrantAccessHelper: - """Helper class for GrantAccess""" - - -__all__ = ["GrantAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_list.py deleted file mode 100644 index 7ccd96c6b83..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_list.py +++ /dev/null @@ -1,486 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot list", -) -class List(AAZCommand): - """List snapshots under a resource group. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/snapshots", "2017-03-30"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.SnapshotsList(ctx=self.ctx)() - if condition_1: - self.SnapshotsListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class SnapshotsList(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.Compute/snapshots", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class SnapshotsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_revoke_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_revoke_access.py deleted file mode 100644 index fb0f81f3223..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_revoke_access.py +++ /dev/null @@ -1,215 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot revoke-access", -) -class RevokeAccess(AAZCommand): - """Revoke access to a snapshot. - - :example: Revoke read access to a snapshot. - az snapshot revoke-access --name MySnapshot --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}/endgetaccess", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsRevokeAccess(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 SnapshotsRevokeAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _RevokeAccessHelper: - """Helper class for RevokeAccess""" - - -__all__ = ["RevokeAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_show.py deleted file mode 100644 index 7396a19849e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_show.py +++ /dev/null @@ -1,282 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot show", -) -class Show(AAZCommand): - """Get information about a snapshot. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(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 SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_update.py deleted file mode 100644 index b12a78deb2d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_update.py +++ /dev/null @@ -1,505 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot update", -) -class Update(AAZCommand): - """Update a snapshot. - - :example: Update a snapshot and associate it with a disk access resource. - az snapshot update --name MySnapshot --resource-group MyResourceGroup --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Update a snapshot. - az snapshot update --name MySnapshot --resource-group MyResourceGroup --subscription MySubscription - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.sku = AAZStrArg( - options=["--sku"], - help="The sku name.", - nullable=True, - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS"}, - ) - - # define Arg Group "Properties" - - # define Arg Group "Snapshot" - return cls._args_schema - - _args_source_vault_update = None - - @classmethod - def _build_args_source_vault_update(cls, _schema): - if cls._args_source_vault_update is not None: - _schema.id = cls._args_source_vault_update.id - return - - cls._args_source_vault_update = AAZObjectArg() - - source_vault_update = cls._args_source_vault_update - source_vault_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_source_vault_update.id - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.SnapshotsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - class SnapshotsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType) - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".sku") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_source_vault_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_snapshot_read = None - - @classmethod - def _build_schema_snapshot_read(cls, _schema): - if cls._schema_snapshot_read is not None: - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - return - - cls._schema_snapshot_read = _schema_snapshot_read = AAZObjectType() - - snapshot_read = _schema_snapshot_read - snapshot_read.id = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.location = AAZStrType( - flags={"required": True}, - ) - snapshot_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - snapshot_read.name = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - snapshot_read.sku = AAZObjectType() - snapshot_read.tags = AAZDictType() - snapshot_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_snapshot_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = _schema_snapshot_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = _schema_snapshot_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = _schema_snapshot_read.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_snapshot_read.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_snapshot_read.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_snapshot_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_snapshot_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_wait.py deleted file mode 100644 index 9d380a32141..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/snapshot/_wait.py +++ /dev/null @@ -1,281 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2017-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(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=False) - return result - - class SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption_settings = cls._schema_on_200.properties.encryption_settings - encryption_settings.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - encryption_settings.enabled = AAZBoolType() - encryption_settings.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/__cmd_group.py deleted file mode 100644 index 9e6797e0f27..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm", -) -class __CMDGroup(AAZCommandGroup): - """Manage Linux or Windows virtual machines. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/__init__.py deleted file mode 100644 index 6063aac9daf..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._convert import * -from ._deallocate import * -from ._generalize import * -from ._list_sizes import * -from ._list_skus import * -from ._list_vm_resize_options import * -from ._perform_maintenance import * -from ._redeploy import * -from ._start import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_convert.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_convert.py deleted file mode 100644 index 8e9741dd34c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_convert.py +++ /dev/null @@ -1,219 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm convert", -) -class Convert(AAZCommand): - """Convert a VM with unmanaged disks to use managed disks. - - :example: Convert a VM with unmanaged disks to use managed disks. - az vm convert -g MyResourceGroup -n MyVm - - :example: Convert all VMs with unmanaged disks in a resource group to use managed disks. - az vm convert --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/converttomanageddisks", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesConvertToManagedDisks(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 VirtualMachinesConvertToManagedDisks(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _ConvertHelper: - """Helper class for Convert""" - - -__all__ = ["Convert"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_deallocate.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_deallocate.py deleted file mode 100644 index e5ca699cedf..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_deallocate.py +++ /dev/null @@ -1,228 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm deallocate", -) -class Deallocate(AAZCommand): - """Deallocate a VM so that computing resources are no longer allocated (charges no longer apply). The status will change from 'Stopped' to 'Stopped (Deallocated)'. - - For an end-to-end tutorial, see https://learn.microsoft.com/azure/virtual-machines/linux/capture-image - - :example: Deallocate, generalize, and capture a stopped virtual machine. - az vm deallocate -g MyResourceGroup -n MyVm - az vm generalize -g MyResourceGroup -n MyVm - az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix - - :example: Deallocate, generalize, and capture multiple stopped virtual machines. - az vm deallocate --ids vms_ids - az vm generalize --ids vms_ids - az vm capture --ids vms_ids --vhd-name-prefix MyPrefix - - :example: Deallocate a VM. - az vm deallocate --name MyVm --no-wait --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/deallocate", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesDeallocate(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 VirtualMachinesDeallocate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _DeallocateHelper: - """Helper class for Deallocate""" - - -__all__ = ["Deallocate"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_generalize.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_generalize.py deleted file mode 100644 index 2098c9f786f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_generalize.py +++ /dev/null @@ -1,208 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm generalize", -) -class Generalize(AAZCommand): - """Mark a VM as generalized, allowing it to be imaged for multiple deployments. - - For an end-to-end tutorial, see https://learn.microsoft.com/azure/virtual-machines/linux/capture-image - - :example: Deallocate, generalize, and capture a stopped virtual machine. - az vm deallocate -g MyResourceGroup -n MyVm - az vm generalize -g MyResourceGroup -n MyVm - az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix - - :example: Deallocate, generalize, and capture multiple stopped virtual machines. - az vm deallocate --ids vms_ids - az vm generalize --ids vms_ids - az vm capture --ids vms_ids --vhd-name-prefix MyPrefix - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/generalize", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachinesGeneralize(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 VirtualMachinesGeneralize(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _GeneralizeHelper: - """Helper class for Generalize""" - - -__all__ = ["Generalize"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_sizes.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_sizes.py deleted file mode 100644 index b969e3e530c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_sizes.py +++ /dev/null @@ -1,177 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-sizes", -) -class ListSizes(AAZCommand): - """List available sizes for VMs. - - :example: List the available VM sizes in the West US region. - az vm list-sizes -l westus - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/vmsizes", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineSizesList(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.value, client_flatten=True) - return result - - class VirtualMachineSizesList(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.Compute/locations/{location}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListSizesHelper: - """Helper class for ListSizes""" - - -__all__ = ["ListSizes"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_skus.py deleted file mode 100644 index 61042225cb3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_skus.py +++ /dev/null @@ -1,343 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-skus", -) -class ListSkus(AAZCommand): - """Get details for compute-related resource SKUs. - - This command incorporates subscription level restriction, offering the most accurate information. - """ - - _aaz_info = { - "version": "2019-04-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/skus", "2019-04-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply on the operation. Only **location** filter is supported currently.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ResourceSkusList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class ResourceSkusList(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.Compute/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "api-version", "2019-04-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.api_versions = AAZListType( - serialized_name="apiVersions", - flags={"read_only": True}, - ) - _element.capabilities = AAZListType( - flags={"read_only": True}, - ) - _element.capacity = AAZObjectType( - flags={"read_only": True}, - ) - _element.costs = AAZListType( - flags={"read_only": True}, - ) - _element.family = AAZStrType( - flags={"read_only": True}, - ) - _element.kind = AAZStrType( - flags={"read_only": True}, - ) - _element.location_info = AAZListType( - serialized_name="locationInfo", - flags={"read_only": True}, - ) - _element.locations = AAZListType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.resource_type = AAZStrType( - serialized_name="resourceType", - flags={"read_only": True}, - ) - _element.restrictions = AAZListType( - flags={"read_only": True}, - ) - _element.size = AAZStrType( - flags={"read_only": True}, - ) - _element.tier = AAZStrType( - flags={"read_only": True}, - ) - - api_versions = cls._schema_on_200.value.Element.api_versions - api_versions.Element = AAZStrType() - - capabilities = cls._schema_on_200.value.Element.capabilities - capabilities.Element = AAZObjectType() - _ListSkusHelper._build_schema_resource_sku_capabilities_read(capabilities.Element) - - capacity = cls._schema_on_200.value.Element.capacity - capacity.default = AAZIntType( - flags={"read_only": True}, - ) - capacity.maximum = AAZIntType( - flags={"read_only": True}, - ) - capacity.minimum = AAZIntType( - flags={"read_only": True}, - ) - capacity.scale_type = AAZStrType( - serialized_name="scaleType", - flags={"read_only": True}, - ) - - costs = cls._schema_on_200.value.Element.costs - costs.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.costs.Element - _element.extended_unit = AAZStrType( - serialized_name="extendedUnit", - flags={"read_only": True}, - ) - _element.meter_id = AAZStrType( - serialized_name="meterID", - flags={"read_only": True}, - ) - _element.quantity = AAZIntType( - flags={"read_only": True}, - ) - - location_info = cls._schema_on_200.value.Element.location_info - location_info.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.location_info.Element - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.zone_details = AAZListType( - serialized_name="zoneDetails", - flags={"read_only": True}, - ) - _element.zones = AAZListType( - flags={"read_only": True}, - ) - - zone_details = cls._schema_on_200.value.Element.location_info.Element.zone_details - zone_details.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element - _element.capabilities = AAZListType( - flags={"read_only": True}, - ) - _element.name = AAZListType( - flags={"read_only": True}, - ) - - capabilities = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element.capabilities - capabilities.Element = AAZObjectType() - _ListSkusHelper._build_schema_resource_sku_capabilities_read(capabilities.Element) - - name = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element.name - name.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.location_info.Element.zones - zones.Element = AAZStrType() - - locations = cls._schema_on_200.value.Element.locations - locations.Element = AAZStrType() - - restrictions = cls._schema_on_200.value.Element.restrictions - restrictions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.restrictions.Element - _element.reason_code = AAZStrType( - serialized_name="reasonCode", - flags={"read_only": True}, - ) - _element.restriction_info = AAZObjectType( - serialized_name="restrictionInfo", - flags={"read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.values = AAZListType( - flags={"read_only": True}, - ) - - restriction_info = cls._schema_on_200.value.Element.restrictions.Element.restriction_info - restriction_info.locations = AAZListType( - flags={"read_only": True}, - ) - restriction_info.zones = AAZListType( - flags={"read_only": True}, - ) - - locations = cls._schema_on_200.value.Element.restrictions.Element.restriction_info.locations - locations.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.restrictions.Element.restriction_info.zones - zones.Element = AAZStrType() - - values = cls._schema_on_200.value.Element.restrictions.Element.values - values.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - _schema_resource_sku_capabilities_read = None - - @classmethod - def _build_schema_resource_sku_capabilities_read(cls, _schema): - if cls._schema_resource_sku_capabilities_read is not None: - _schema.name = cls._schema_resource_sku_capabilities_read.name - _schema.value = cls._schema_resource_sku_capabilities_read.value - return - - cls._schema_resource_sku_capabilities_read = _schema_resource_sku_capabilities_read = AAZObjectType() - - resource_sku_capabilities_read = _schema_resource_sku_capabilities_read - resource_sku_capabilities_read.name = AAZStrType( - flags={"read_only": True}, - ) - resource_sku_capabilities_read.value = AAZStrType( - flags={"read_only": True}, - ) - - _schema.name = cls._schema_resource_sku_capabilities_read.name - _schema.value = cls._schema_resource_sku_capabilities_read.value - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_vm_resize_options.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_vm_resize_options.py deleted file mode 100644 index d29242263a0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_list_vm_resize_options.py +++ /dev/null @@ -1,190 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-vm-resize-options", -) -class ListVmResizeOptions(AAZCommand): - """List available resizing options for VMs. - - :example: List all available VM sizes for resizing. - az vm list-vm-resize-options -g MyResourceGroup -n MyVm - - :example: List available sizes for all VMs in a resource group. - az vm list-vm-resize-options --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/vmsizes", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachinesListAvailableSizes(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.value, client_flatten=True) - return result - - class VirtualMachinesListAvailableSizes(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListVmResizeOptionsHelper: - """Helper class for ListVmResizeOptions""" - - -__all__ = ["ListVmResizeOptions"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_perform_maintenance.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_perform_maintenance.py deleted file mode 100644 index 1abff36307f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_perform_maintenance.py +++ /dev/null @@ -1,213 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm perform-maintenance", -) -class PerformMaintenance(AAZCommand): - """The operation to perform maintenance on a virtual machine. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/performmaintenance", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesPerformMaintenance(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 VirtualMachinesPerformMaintenance(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _PerformMaintenanceHelper: - """Helper class for PerformMaintenance""" - - -__all__ = ["PerformMaintenance"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_redeploy.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_redeploy.py deleted file mode 100644 index 2e75be6010f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_redeploy.py +++ /dev/null @@ -1,219 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm redeploy", -) -class Redeploy(AAZCommand): - """Redeploy an existing VM. - - :example: Redeploy a VM. - az vm redeploy -g MyResourceGroup -n MyVm - - :example: Redeploy all VMs in a resource group. - az vm redeploy --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/redeploy", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesRedeploy(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 VirtualMachinesRedeploy(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _RedeployHelper: - """Helper class for Redeploy""" - - -__all__ = ["Redeploy"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_start.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_start.py deleted file mode 100644 index faa81da203f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/_start.py +++ /dev/null @@ -1,222 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm start", -) -class Start(AAZCommand): - """Start a stopped VM. - - :example: Start a stopped VM. - az vm start -g MyResourceGroup -n MyVm - - :example: Start all VMs in a resource group. - az vm start --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - - :example: Start a stopped VM. - az vm start --name MyVm --no-wait --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/start", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesStart(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 VirtualMachinesStart(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _StartHelper: - """Helper class for Start""" - - -__all__ = ["Start"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/__cmd_group.py deleted file mode 100644 index 0311e45bc8c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/__cmd_group.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set", -) -class __CMDGroup(AAZCommandGroup): - """Group resources into availability sets. - - To provide redundancy to an application, it is recommended to group two or more virtual machines in an availability set. This configuration ensures that during either a planned or unplanned maintenance event, at least one virtual machine will be available. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/__init__.py deleted file mode 100644 index 8dd5aa6e8ed..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * -from ._list import * -from ._list_sizes import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_delete.py deleted file mode 100644 index a948a2e4618..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_delete.py +++ /dev/null @@ -1,201 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set delete", -) -class Delete(AAZCommand): - """Delete an availability set. - - :example: Delete an availability set. - az vm availability-set delete -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2017-12-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class AvailabilitySetsDelete(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) - if session.http_response.status_code in [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_list.py deleted file mode 100644 index 1fab7cd1d5f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_list.py +++ /dev/null @@ -1,376 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set list", -) -class List(AAZCommand): - """List all availability sets in a subscription. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/availabilitysets", "2017-12-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets", "2017-12-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply to the operation. Allowed values are 'virtualMachines/$ref'.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.AvailabilitySetsListBySubscription(ctx=self.ctx)() - if condition_1: - self.AvailabilitySetsList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class AvailabilitySetsListBySubscription(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.Compute/availabilitySets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.value.Element.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machines.Element - _element.id = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class AvailabilitySetsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.value.Element.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machines.Element - _element.id = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_list_sizes.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_list_sizes.py deleted file mode 100644 index 24c155323b2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_list_sizes.py +++ /dev/null @@ -1,186 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set list-sizes", -) -class ListSizes(AAZCommand): - """List all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. - - :example: List VM sizes for an availability set. - az vm availability-set list-sizes -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}/vmsizes", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsListAvailableSizes(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.value, client_flatten=True) - return result - - class AvailabilitySetsListAvailableSizes(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListSizesHelper: - """Helper class for ListSizes""" - - -__all__ = ["ListSizes"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_show.py deleted file mode 100644 index 5f73a6dc03a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_show.py +++ /dev/null @@ -1,221 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set show", -) -class Show(AAZCommand): - """Get information about an availability set. - - :example: Get information about an availability set. - az vm availability-set show -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(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 AvailabilitySetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.virtual_machines.Element - _element.id = AAZStrType() - - sku = cls._schema_on_200.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_update.py deleted file mode 100644 index 54fc59eb358..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/availability_set/_update.py +++ /dev/null @@ -1,425 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set update", -) -class Update(AAZCommand): - """Update an Azure Availability Set. - - :example: Update an availability set - az vm availability-set update -n MyAvSet -g MyResourceGroup - - :example: Update an availability set tag. - az vm availability-set update -n MyAvSet -g MyResourceGroup --set tags.foo=value - - :example: Remove an availability set tag. - az vm availability-set update -n MyAvSet -g MyResourceGroup --remove tags.foo - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2017-12-01"], - ] - } - - AZ_SUPPORT_GENERIC_UPDATE = True - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.platform_fault_domain_count = AAZIntArg( - options=["--platform-fault-domain-count"], - help="Fault Domain count.", - nullable=True, - ) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - help="Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'.", - nullable=True, - ) - - sku = cls._args_schema.sku - sku.capacity = AAZIntArg( - options=["capacity"], - help="Specifies the number of virtual machines in the scale set.", - nullable=True, - ) - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - nullable=True, - ) - sku.tier = AAZStrArg( - options=["tier"], - help="Specifies the tier of virtual machines in a scale set.

Possible Values:

**Standard**

**Basic**", - nullable=True, - ) - - # define Arg Group "Properties" - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.AvailabilitySetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class AvailabilitySetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_availability_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - class AvailabilitySetsCreateOrUpdate(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_availability_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("platformFaultDomainCount", AAZIntType, ".platform_fault_domain_count") - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("capacity", AAZIntType, ".capacity") - sku.set_prop("name", AAZStrType, ".name") - sku.set_prop("tier", AAZStrType, ".tier") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - _schema_availability_set_read = None - - @classmethod - def _build_schema_availability_set_read(cls, _schema): - if cls._schema_availability_set_read is not None: - _schema.id = cls._schema_availability_set_read.id - _schema.location = cls._schema_availability_set_read.location - _schema.name = cls._schema_availability_set_read.name - _schema.properties = cls._schema_availability_set_read.properties - _schema.sku = cls._schema_availability_set_read.sku - _schema.tags = cls._schema_availability_set_read.tags - _schema.type = cls._schema_availability_set_read.type - return - - cls._schema_availability_set_read = _schema_availability_set_read = AAZObjectType() - - availability_set_read = _schema_availability_set_read - availability_set_read.id = AAZStrType( - flags={"read_only": True}, - ) - availability_set_read.location = AAZStrType( - flags={"required": True}, - ) - availability_set_read.name = AAZStrType( - flags={"read_only": True}, - ) - availability_set_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - availability_set_read.sku = AAZObjectType() - availability_set_read.tags = AAZDictType() - availability_set_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_availability_set_read.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = _schema_availability_set_read.properties.statuses - statuses.Element = AAZObjectType() - - _element = _schema_availability_set_read.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = _schema_availability_set_read.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = _schema_availability_set_read.properties.virtual_machines.Element - _element.id = AAZStrType() - - sku = _schema_availability_set_read.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = _schema_availability_set_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_availability_set_read.id - _schema.location = cls._schema_availability_set_read.location - _schema.name = cls._schema_availability_set_read.name - _schema.properties = cls._schema_availability_set_read.properties - _schema.sku = cls._schema_availability_set_read.sku - _schema.tags = cls._schema_availability_set_read.tags - _schema.type = cls._schema_availability_set_read.type - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/__cmd_group.py deleted file mode 100644 index 5951a534238..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/__cmd_group.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension", -) -class __CMDGroup(AAZCommandGroup): - """Manage extensions on VMs. - - Extensions are small applications that provide post-deployment configuration and automation tasks on Azure virtual machines. For example, if a virtual machine requires software installation, anti-virus protection, or Docker configuration, a VM extension can be used to complete these tasks. Extensions can be bundled with a new virtual machine deployment or run against any existing system. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/__init__.py deleted file mode 100644 index af9cedd3228..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/_delete.py deleted file mode 100644 index 5c7fe543a5d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/_delete.py +++ /dev/null @@ -1,240 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension delete", -) -class Delete(AAZCommand): - """Delete operation to delete the extension. - - :example: Use a VM name and extension to delete an extension from a VM. - az vm extension delete -g MyResourceGroup --vm-name MyVm -n MyExtensionName - - :example: Delete extensions with IDs containing the string "MyExtension" from a VM. - az vm extension delete --ids $(az resource list --query "[?contains(name, 'MyExtension')].id" -o tsv) - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/extensions/{}", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_extension_name = AAZStrArg( - options=["-n", "--name", "--vm-extension-name"], - help="The name of the virtual machine extension.", - required=True, - id_part="child_name_1", - ) - _args_schema.vm_name = AAZStrArg( - options=["--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineExtensionsDelete(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 VirtualMachineExtensionsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmExtensionName", self.ctx.args.vm_extension_name, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/__cmd_group.py deleted file mode 100644 index 98e25e5aa1d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image", -) -class __CMDGroup(AAZCommandGroup): - """Find the available VM extensions for a subscription and region. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/__init__.py deleted file mode 100644 index 4b2012758a6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list_names import * -from ._list_versions import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_list_names.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_list_names.py deleted file mode 100644 index c6e6a3ab0aa..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_list_names.py +++ /dev/null @@ -1,211 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image list-names", -) -class ListNames(AAZCommand): - """List the names of available extensions. - - :example: Find Docker extensions by publisher and location. - az vm extension image list-names --publisher Microsoft.Azure.Extensions -l westus --query "[?starts_with(name, 'Docker')]" - - :example: Find CustomScript extensions by publisher and location. - az vm extension image list-names --publisher Microsoft.Azure.Extensions -l westus --query "[?starts_with(name, 'Custom')]" - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesListTypes(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 VirtualMachineExtensionImagesListTypes(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **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", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.Element.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListNamesHelper: - """Helper class for ListNames""" - - -__all__ = ["ListNames"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_list_versions.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_list_versions.py deleted file mode 100644 index d21c05c12c8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_list_versions.py +++ /dev/null @@ -1,239 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image list-versions", -) -class ListVersions(AAZCommand): - """List the versions for available extensions. - - :example: Find the available versions for the Docker extension. - az vm extension image list-versions --publisher Microsoft.Azure.Extensions -l westus -n DockerExtension -o table - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types/{}/versions", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name", "--type"], - help="Name of the extension.", - required=True, - id_part="child_name_3", - ) - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply on the operation. Default value is None.", - ) - _args_schema.orderby = AAZStrArg( - options=["--orderby"], - help="The $orderby odata query option.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="The $top odata query option.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesListVersions(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 VirtualMachineExtensionImagesListVersions(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "type", self.ctx.args.name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "$orderby", self.ctx.args.orderby, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.Element.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListVersionsHelper: - """Helper class for ListVersions""" - - -__all__ = ["ListVersions"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_show.py deleted file mode 100644 index 4273ae26c3a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/extension/image/_show.py +++ /dev/null @@ -1,229 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image show", -) -class Show(AAZCommand): - """Display information for an extension. - - :example: Show the CustomScript extension version 2.0.2. - az vm extension image show -l westus -n CustomScript --publisher Microsoft.Azure.Extensions --version 2.0.2 - - :example: Show the latest version of the Docker extension. - az vm extension image list-versions --publisher Microsoft.Azure.Extensions -l westus -n DockerExtension --query "[].name" -o tsv | sort | tail -n 1 - az vm extension image show -l westus --publisher Microsoft.Azure.Extensions -n DockerExtension --version LatestVersion - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types/{}/versions/{}", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name", "--type"], - help="Name of the extension.", - required=True, - id_part="child_name_3", - ) - _args_schema.version = AAZStrArg( - options=["--version"], - help="Extension version.", - required=True, - id_part="child_name_4", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesGet(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 VirtualMachineExtensionImagesGet(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "type", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "version", self.ctx.args.version, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/__cmd_group.py deleted file mode 100644 index b78c1878632..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image", -) -class __CMDGroup(AAZCommandGroup): - """Information on available virtual machine images. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/__init__.py deleted file mode 100644 index 069febe7e47..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._list_offers import * -from ._list_publishers import * -from ._list_skus import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list.py deleted file mode 100644 index 3c812c4f7a2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list.py +++ /dev/null @@ -1,243 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - ) - _args_schema.sku = AAZStrArg( - options=["-s", "--sku"], - help="A valid image SKU.", - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - _args_schema.orderby = AAZStrArg( - options=["--orderby"], - ) - _args_schema.top = AAZIntArg( - options=["--top"], - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesList(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 VirtualMachineImagesList(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **self.serialize_url_param( - "skus", self.ctx.args.sku, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "$orderby", self.ctx.args.orderby, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_offers.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_offers.py deleted file mode 100644 index ff1ea2aebf3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_offers.py +++ /dev/null @@ -1,217 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-offers", -) -class ListOffers(AAZCommand): - """List a list of virtual machine image offers for the specified location and publisher. - - :example: List all offers from Microsoft in the West US region. - az vm image list-offers -l westus -p MicrosoftWindowsServer - - :example: List all offers from OpenLocic in the West US region. - az vm image list-offers -l westus -p OpenLogic - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListOffers(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 VirtualMachineImagesListOffers(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListOffersHelper: - """Helper class for ListOffers""" - - -__all__ = ["ListOffers"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_publishers.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_publishers.py deleted file mode 100644 index d3d0f5c0d93..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_publishers.py +++ /dev/null @@ -1,207 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-publishers", -) -class ListPublishers(AAZCommand): - """List a list of virtual machine image publishers for the specified Azure location. - - :example: List all publishers in the West US region. - az vm image list-publishers -l westus - - :example: List all publishers with names starting with "Open" in westus. - az vm image list-publishers -l westus --query "[?starts_with(name, 'Open')]" - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListPublishers(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 VirtualMachineImagesListPublishers(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.Compute/locations/{location}/publishers", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListPublishersHelper: - """Helper class for ListPublishers""" - - -__all__ = ["ListPublishers"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_skus.py deleted file mode 100644 index b66d2eaf28c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_list_skus.py +++ /dev/null @@ -1,224 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-skus", -) -class ListSkus(AAZCommand): - """List a list of virtual machine image SKUs for the specified location, publisher, and offer. - - :example: List all skus available for CentOS published by OpenLogic in the West US region. - az vm image list-skus -l westus -f CentOS -p OpenLogic - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - id_part="child_name_3", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListSkus(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 VirtualMachineImagesListSkus(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_show.py deleted file mode 100644 index 34557d9ec96..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vm/image/_show.py +++ /dev/null @@ -1,243 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get a virtual machine image. - - :example: Get the details for a VM image available in the Azure Marketplace. - az vm image show --location westus --urn publisher:offer:sku:version - - :example: Show information for the latest available CentOS image from OpenLogic. - az vm image show -l westus -f CentOS -p OpenLogic --sku 7.3 --version $(az vm image list -p OpenLogic -s 7.3 --all --query "[?offer=='CentOS'].version" -o tsv | sort -u | tail -n 1) - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions/{}", "2017-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - id_part="child_name_3", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - _args_schema.sku = AAZStrArg( - options=["-s", "--sku"], - help="A valid image SKU.", - required=True, - id_part="child_name_4", - ) - _args_schema.version = AAZStrArg( - options=["--version"], - help="A valid image SKU version.", - required=True, - id_part="child_name_5", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesGet(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 VirtualMachineImagesGet(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **self.serialize_url_param( - "skus", self.ctx.args.sku, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "version", self.ctx.args.version, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType() - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - - properties = cls._schema_on_200.properties - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - data_disk_images = cls._schema_on_200.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - os_disk_image = cls._schema_on_200.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/__cmd_group.py deleted file mode 100644 index c3779a0d2d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss", -) -class __CMDGroup(AAZCommandGroup): - """Manage groupings of virtual machines in an Azure Virtual Machine Scale Set (VMSS). - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/__init__.py deleted file mode 100644 index a93d00317ca..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * -from ._list import * -from ._list_instance_public_ips import * -from ._list_instances import * -from ._list_skus import * -from ._perform_maintenance import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_delete.py deleted file mode 100644 index e79aad349ca..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_delete.py +++ /dev/null @@ -1,224 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss delete", -) -class Delete(AAZCommand): - """Delete a VM scale set. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetsDelete(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 VirtualMachineScaleSetsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list.py deleted file mode 100644 index a4752f9df1a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list.py +++ /dev/null @@ -1,1251 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list", -) -class List(AAZCommand): - """List all VM scale sets under a resource group. - - :example: List VMSS - az vmss list --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/virtualmachinescalesets", "2017-12-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets", "2017-12-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.VirtualMachineScaleSetsListAll(ctx=self.ctx)() - if condition_1: - self.VirtualMachineScaleSetsList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetsListAll(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.Compute/virtualMachineScaleSets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.identity = AAZObjectType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - identity = cls._schema_on_200.value.Element.identity - identity.identity_ids = AAZListType( - serialized_name="identityIds", - ) - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - - identity_ids = cls._schema_on_200.value.Element.identity.identity_ids - identity_ids.Element = AAZStrType() - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.overprovision = AAZBoolType() - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.single_placement_group = AAZBoolType( - serialized_name="singlePlacementGroup", - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - properties.upgrade_policy = AAZObjectType( - serialized_name="upgradePolicy", - ) - properties.virtual_machine_profile = AAZObjectType( - serialized_name="virtualMachineProfile", - ) - properties.zone_balance = AAZBoolType( - serialized_name="zoneBalance", - ) - - upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy - upgrade_policy.auto_os_upgrade_policy = AAZObjectType( - serialized_name="autoOSUpgradePolicy", - ) - upgrade_policy.automatic_os_upgrade = AAZBoolType( - serialized_name="automaticOSUpgrade", - ) - upgrade_policy.mode = AAZStrType() - upgrade_policy.rolling_upgrade_policy = AAZObjectType( - serialized_name="rollingUpgradePolicy", - ) - - auto_os_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.auto_os_upgrade_policy - auto_os_upgrade_policy.disable_auto_rollback = AAZBoolType( - serialized_name="disableAutoRollback", - ) - - rolling_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.rolling_upgrade_policy - rolling_upgrade_policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - rolling_upgrade_policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - - virtual_machine_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile - virtual_machine_profile.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - virtual_machine_profile.eviction_policy = AAZStrType( - serialized_name="evictionPolicy", - ) - virtual_machine_profile.extension_profile = AAZObjectType( - serialized_name="extensionProfile", - ) - virtual_machine_profile.license_type = AAZStrType( - serialized_name="licenseType", - ) - virtual_machine_profile.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - virtual_machine_profile.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - virtual_machine_profile.priority = AAZStrType() - virtual_machine_profile.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - extension_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile - extension_profile.extensions = AAZListType() - - extensions = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions - extensions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - network_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile - network_profile.health_probe = AAZObjectType( - serialized_name="healthProbe", - ) - _ListHelper._build_schema_api_entity_reference_read(network_profile.health_probe) - network_profile.network_interface_configurations = AAZListType( - serialized_name="networkInterfaceConfigurations", - ) - - network_interface_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations - network_interface_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"required": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.network_security_group) - properties.primary = AAZBoolType() - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_pools = AAZListType( - serialized_name="loadBalancerInboundNatPools", - ) - properties.primary = AAZBoolType() - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.public_ip_address_configuration = AAZObjectType( - serialized_name="publicIPAddressConfiguration", - ) - properties.subnet = AAZObjectType() - _ListHelper._build_schema_api_entity_reference_read(properties.subnet) - - application_gateway_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(application_gateway_backend_address_pools.Element) - - load_balancer_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_inbound_nat_pools - load_balancer_inbound_nat_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_inbound_nat_pools.Element) - - public_ip_address_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration - public_ip_address_configuration.name = AAZStrType( - flags={"required": True}, - ) - public_ip_address_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - flags={"required": True}, - ) - - os_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.computer_name_prefix = AAZStrType( - serialized_name="computerNamePrefix", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - win_rm = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - storage_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - _element.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - image_reference = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.image_reference - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.image = AAZObjectType() - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd_containers = AAZListType( - serialized_name="vhdContainers", - ) - os_disk.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - image = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.image - image.uri = AAZStrType() - - vhd_containers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.vhd_containers - vhd_containers.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class VirtualMachineScaleSetsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.identity = AAZObjectType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - identity = cls._schema_on_200.value.Element.identity - identity.identity_ids = AAZListType( - serialized_name="identityIds", - ) - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - - identity_ids = cls._schema_on_200.value.Element.identity.identity_ids - identity_ids.Element = AAZStrType() - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.overprovision = AAZBoolType() - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.single_placement_group = AAZBoolType( - serialized_name="singlePlacementGroup", - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - properties.upgrade_policy = AAZObjectType( - serialized_name="upgradePolicy", - ) - properties.virtual_machine_profile = AAZObjectType( - serialized_name="virtualMachineProfile", - ) - properties.zone_balance = AAZBoolType( - serialized_name="zoneBalance", - ) - - upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy - upgrade_policy.auto_os_upgrade_policy = AAZObjectType( - serialized_name="autoOSUpgradePolicy", - ) - upgrade_policy.automatic_os_upgrade = AAZBoolType( - serialized_name="automaticOSUpgrade", - ) - upgrade_policy.mode = AAZStrType() - upgrade_policy.rolling_upgrade_policy = AAZObjectType( - serialized_name="rollingUpgradePolicy", - ) - - auto_os_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.auto_os_upgrade_policy - auto_os_upgrade_policy.disable_auto_rollback = AAZBoolType( - serialized_name="disableAutoRollback", - ) - - rolling_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.rolling_upgrade_policy - rolling_upgrade_policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - rolling_upgrade_policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - - virtual_machine_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile - virtual_machine_profile.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - virtual_machine_profile.eviction_policy = AAZStrType( - serialized_name="evictionPolicy", - ) - virtual_machine_profile.extension_profile = AAZObjectType( - serialized_name="extensionProfile", - ) - virtual_machine_profile.license_type = AAZStrType( - serialized_name="licenseType", - ) - virtual_machine_profile.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - virtual_machine_profile.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - virtual_machine_profile.priority = AAZStrType() - virtual_machine_profile.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - extension_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile - extension_profile.extensions = AAZListType() - - extensions = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions - extensions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - network_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile - network_profile.health_probe = AAZObjectType( - serialized_name="healthProbe", - ) - _ListHelper._build_schema_api_entity_reference_read(network_profile.health_probe) - network_profile.network_interface_configurations = AAZListType( - serialized_name="networkInterfaceConfigurations", - ) - - network_interface_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations - network_interface_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"required": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.network_security_group) - properties.primary = AAZBoolType() - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_pools = AAZListType( - serialized_name="loadBalancerInboundNatPools", - ) - properties.primary = AAZBoolType() - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.public_ip_address_configuration = AAZObjectType( - serialized_name="publicIPAddressConfiguration", - ) - properties.subnet = AAZObjectType() - _ListHelper._build_schema_api_entity_reference_read(properties.subnet) - - application_gateway_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(application_gateway_backend_address_pools.Element) - - load_balancer_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_inbound_nat_pools - load_balancer_inbound_nat_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_inbound_nat_pools.Element) - - public_ip_address_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration - public_ip_address_configuration.name = AAZStrType( - flags={"required": True}, - ) - public_ip_address_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - flags={"required": True}, - ) - - os_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.computer_name_prefix = AAZStrType( - serialized_name="computerNamePrefix", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - win_rm = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - storage_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - _element.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - image_reference = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.image_reference - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.image = AAZObjectType() - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd_containers = AAZListType( - serialized_name="vhdContainers", - ) - os_disk.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - image = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.image - image.uri = AAZStrType() - - vhd_containers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.vhd_containers - vhd_containers.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_api_entity_reference_read = None - - @classmethod - def _build_schema_api_entity_reference_read(cls, _schema): - if cls._schema_api_entity_reference_read is not None: - _schema.id = cls._schema_api_entity_reference_read.id - return - - cls._schema_api_entity_reference_read = _schema_api_entity_reference_read = AAZObjectType() - - api_entity_reference_read = _schema_api_entity_reference_read - api_entity_reference_read.id = AAZStrType() - - _schema.id = cls._schema_api_entity_reference_read.id - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_virtual_machine_scale_set_managed_disk_parameters_read = None - - @classmethod - def _build_schema_virtual_machine_scale_set_managed_disk_parameters_read(cls, _schema): - if cls._schema_virtual_machine_scale_set_managed_disk_parameters_read is not None: - _schema.storage_account_type = cls._schema_virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type - return - - cls._schema_virtual_machine_scale_set_managed_disk_parameters_read = _schema_virtual_machine_scale_set_managed_disk_parameters_read = AAZObjectType() - - virtual_machine_scale_set_managed_disk_parameters_read = _schema_virtual_machine_scale_set_managed_disk_parameters_read - virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - _schema.storage_account_type = cls._schema_virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_instance_public_ips.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_instance_public_ips.py deleted file mode 100644 index abba94d5900..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_instance_public_ips.py +++ /dev/null @@ -1,1535 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class ListInstancePublicIps(AAZCommand): - """List information about all public IP addresses on a virtual machine scale set level. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/publicipaddresses", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vmss_name = AAZStrArg( - options=["--vmss-name"], - help="The name of the virtual machine scale set.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PublicIPAddressesListVirtualMachineScaleSetPublicIPAddresses(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class PublicIPAddressesListVirtualMachineScaleSetPublicIPAddresses(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.vmss_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListInstancePublicIpsHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - -class _ListInstancePublicIpsHelper: - """Helper class for ListInstancePublicIps""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - cls._build_schema_private_endpoint_read(properties.private_endpoint) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_private_endpoint_read = None - - @classmethod - def _build_schema_private_endpoint_read(cls, _schema): - if cls._schema_private_endpoint_read is not None: - _schema.etag = cls._schema_private_endpoint_read.etag - _schema.id = cls._schema_private_endpoint_read.id - _schema.location = cls._schema_private_endpoint_read.location - _schema.name = cls._schema_private_endpoint_read.name - _schema.properties = cls._schema_private_endpoint_read.properties - _schema.tags = cls._schema_private_endpoint_read.tags - _schema.type = cls._schema_private_endpoint_read.type - return - - cls._schema_private_endpoint_read = _schema_private_endpoint_read = AAZObjectType() - - private_endpoint_read = _schema_private_endpoint_read - private_endpoint_read.etag = AAZStrType() - private_endpoint_read.id = AAZStrType() - private_endpoint_read.location = AAZStrType() - private_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - private_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - private_endpoint_read.tags = AAZDictType() - private_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_private_endpoint_read.properties - properties.manual_private_link_service_connections = AAZListType( - serialized_name="manualPrivateLinkServiceConnections", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.private_link_service_connections = AAZListType( - serialized_name="privateLinkServiceConnections", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - manual_private_link_service_connections = _schema_private_endpoint_read.properties.manual_private_link_service_connections - manual_private_link_service_connections.Element = AAZObjectType() - cls._build_schema_private_link_service_connection_read(manual_private_link_service_connections.Element) - - network_interfaces = _schema_private_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - private_link_service_connections = _schema_private_endpoint_read.properties.private_link_service_connections - private_link_service_connections.Element = AAZObjectType() - cls._build_schema_private_link_service_connection_read(private_link_service_connections.Element) - - tags = _schema_private_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_private_endpoint_read.etag - _schema.id = cls._schema_private_endpoint_read.id - _schema.location = cls._schema_private_endpoint_read.location - _schema.name = cls._schema_private_endpoint_read.name - _schema.properties = cls._schema_private_endpoint_read.properties - _schema.tags = cls._schema_private_endpoint_read.tags - _schema.type = cls._schema_private_endpoint_read.type - - _schema_private_link_service_connection_read = None - - @classmethod - def _build_schema_private_link_service_connection_read(cls, _schema): - if cls._schema_private_link_service_connection_read is not None: - _schema.etag = cls._schema_private_link_service_connection_read.etag - _schema.id = cls._schema_private_link_service_connection_read.id - _schema.name = cls._schema_private_link_service_connection_read.name - _schema.properties = cls._schema_private_link_service_connection_read.properties - _schema.type = cls._schema_private_link_service_connection_read.type - return - - cls._schema_private_link_service_connection_read = _schema_private_link_service_connection_read = AAZObjectType() - - private_link_service_connection_read = _schema_private_link_service_connection_read - private_link_service_connection_read.etag = AAZStrType( - flags={"read_only": True}, - ) - private_link_service_connection_read.id = AAZStrType() - private_link_service_connection_read.name = AAZStrType() - private_link_service_connection_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - private_link_service_connection_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_private_link_service_connection_read.properties - properties.group_ids = AAZListType( - serialized_name="groupIds", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - ) - properties.private_link_service_id = AAZStrType( - serialized_name="privateLinkServiceId", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.request_message = AAZStrType( - serialized_name="requestMessage", - ) - - group_ids = _schema_private_link_service_connection_read.properties.group_ids - group_ids.Element = AAZStrType() - - private_link_service_connection_state = _schema_private_link_service_connection_read.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - _schema.etag = cls._schema_private_link_service_connection_read.etag - _schema.id = cls._schema_private_link_service_connection_read.id - _schema.name = cls._schema_private_link_service_connection_read.name - _schema.properties = cls._schema_private_link_service_connection_read.properties - _schema.type = cls._schema_private_link_service_connection_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.nat_gateway = AAZObjectType( - serialized_name="natGateway", - ) - cls._build_schema_sub_resource_read(properties.nat_gateway) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.private_endpoint_network_policies = AAZStrType( - serialized_name="privateEndpointNetworkPolicies", - ) - properties.private_endpoints = AAZListType( - serialized_name="privateEndpoints", - flags={"read_only": True}, - ) - properties.private_link_service_network_policies = AAZStrType( - serialized_name="privateLinkServiceNetworkPolicies", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - private_endpoints = _schema_subnet_read.properties.private_endpoints - private_endpoints.Element = AAZObjectType() - cls._build_schema_private_endpoint_read(private_endpoints.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.allow_delete = AAZBoolType( - serialized_name="allowDelete", - ) - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.locations = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - locations = _schema_subnet_read.properties.service_association_links.Element.properties.locations - locations.Element = AAZStrType() - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.type = AAZStrType( - flags={"read_only": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["ListInstancePublicIps"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_instances.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_instances.py deleted file mode 100644 index 67a98a16aa8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_instances.py +++ /dev/null @@ -1,816 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list-instances", -) -class ListInstances(AAZCommand): - """List all virtual machines in a VM scale sets. - - Return a list of virtual machines managed by VMSS. For VMSS in Flexible Orchestration mode, please use "az vm list" to get full details. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines", "2017-12-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--virtual-machine-scale-set-name"], - help="The name of the VM scale set.", - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply to the operation. Allowed values are 'instanceView'.", - ) - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.", - ) - _args_schema.select = AAZStrArg( - options=["--select"], - help="The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetVMsList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetVMsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "$select", self.ctx.args.select, - ), - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.instance_id = AAZStrType( - serialized_name="instanceId", - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.resources = AAZListType( - flags={"read_only": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.availability_set = AAZObjectType( - serialized_name="availabilitySet", - ) - _ListInstancesHelper._build_schema_sub_resource_read(properties.availability_set) - properties.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - properties.hardware_profile = AAZObjectType( - serialized_name="hardwareProfile", - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - properties.latest_model_applied = AAZBoolType( - serialized_name="latestModelApplied", - flags={"read_only": True}, - ) - properties.license_type = AAZStrType( - serialized_name="licenseType", - ) - properties.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - properties.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - properties.vm_id = AAZStrType( - serialized_name="vmId", - flags={"read_only": True}, - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - hardware_profile = cls._schema_on_200.value.Element.properties.hardware_profile - hardware_profile.vm_size = AAZStrType( - serialized_name="vmSize", - ) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - instance_view.disks = AAZListType() - instance_view.extensions = AAZListType() - instance_view.maintenance_redeploy_status = AAZObjectType( - serialized_name="maintenanceRedeployStatus", - ) - instance_view.placement_group_id = AAZStrType( - serialized_name="placementGroupId", - ) - instance_view.platform_fault_domain = AAZIntType( - serialized_name="platformFaultDomain", - ) - instance_view.platform_update_domain = AAZIntType( - serialized_name="platformUpdateDomain", - ) - instance_view.rdp_thumb_print = AAZStrType( - serialized_name="rdpThumbPrint", - ) - instance_view.statuses = AAZListType() - instance_view.vm_agent = AAZObjectType( - serialized_name="vmAgent", - ) - instance_view.vm_health = AAZObjectType( - serialized_name="vmHealth", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.instance_view.boot_diagnostics - boot_diagnostics.console_screenshot_blob_uri = AAZStrType( - serialized_name="consoleScreenshotBlobUri", - flags={"read_only": True}, - ) - boot_diagnostics.serial_console_log_blob_uri = AAZStrType( - serialized_name="serialConsoleLogBlobUri", - flags={"read_only": True}, - ) - - disks = cls._schema_on_200.value.Element.properties.instance_view.disks - disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.disks.Element - _element.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - _element.name = AAZStrType() - _element.statuses = AAZListType() - - encryption_settings = cls._schema_on_200.value.Element.properties.instance_view.disks.Element.encryption_settings - encryption_settings.Element = AAZObjectType() - _ListInstancesHelper._build_schema_disk_encryption_settings_read(encryption_settings.Element) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.disks.Element.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - extensions = cls._schema_on_200.value.Element.properties.instance_view.extensions - extensions.Element = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_machine_extension_instance_view_read(extensions.Element) - - maintenance_redeploy_status = cls._schema_on_200.value.Element.properties.instance_view.maintenance_redeploy_status - maintenance_redeploy_status.is_customer_initiated_maintenance_allowed = AAZBoolType( - serialized_name="isCustomerInitiatedMaintenanceAllowed", - ) - maintenance_redeploy_status.last_operation_message = AAZStrType( - serialized_name="lastOperationMessage", - ) - maintenance_redeploy_status.last_operation_result_code = AAZStrType( - serialized_name="lastOperationResultCode", - ) - maintenance_redeploy_status.maintenance_window_end_time = AAZStrType( - serialized_name="maintenanceWindowEndTime", - ) - maintenance_redeploy_status.maintenance_window_start_time = AAZStrType( - serialized_name="maintenanceWindowStartTime", - ) - maintenance_redeploy_status.pre_maintenance_window_end_time = AAZStrType( - serialized_name="preMaintenanceWindowEndTime", - ) - maintenance_redeploy_status.pre_maintenance_window_start_time = AAZStrType( - serialized_name="preMaintenanceWindowStartTime", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - vm_agent = cls._schema_on_200.value.Element.properties.instance_view.vm_agent - vm_agent.extension_handlers = AAZListType( - serialized_name="extensionHandlers", - ) - vm_agent.statuses = AAZListType() - vm_agent.vm_agent_version = AAZStrType( - serialized_name="vmAgentVersion", - ) - - extension_handlers = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.extension_handlers - extension_handlers.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.extension_handlers.Element - _element.status = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(_element.status) - _element.type = AAZStrType() - _element.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - vm_health = cls._schema_on_200.value.Element.properties.instance_view.vm_health - vm_health.status = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(vm_health.status) - - network_profile = cls._schema_on_200.value.Element.properties.network_profile - network_profile.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - - network_interfaces = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces.Element - _element.id = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces.Element.properties - properties.primary = AAZBoolType() - - os_profile = cls._schema_on_200.value.Element.properties.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.computer_name = AAZStrType( - serialized_name="computerName", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListInstancesHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - win_rm = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.image = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(_element.image) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListInstancesHelper._build_schema_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - _element.vhd = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(_element.vhd) - _element.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - image_reference = cls._schema_on_200.value.Element.properties.storage_profile.image_reference - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - _ListInstancesHelper._build_schema_disk_encryption_settings_read(os_disk.encryption_settings) - os_disk.image = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(os_disk.image) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListInstancesHelper._build_schema_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(os_disk.vhd) - os_disk.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - resources = cls._schema_on_200.value.Element.resources - resources.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.resources.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.resources.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - _ListInstancesHelper._build_schema_virtual_machine_extension_instance_view_read(properties.instance_view) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - tags = cls._schema_on_200.value.Element.resources.Element.tags - tags.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListInstancesHelper: - """Helper class for ListInstances""" - - _schema_disk_encryption_settings_read = None - - @classmethod - def _build_schema_disk_encryption_settings_read(cls, _schema): - if cls._schema_disk_encryption_settings_read is not None: - _schema.disk_encryption_key = cls._schema_disk_encryption_settings_read.disk_encryption_key - _schema.enabled = cls._schema_disk_encryption_settings_read.enabled - _schema.key_encryption_key = cls._schema_disk_encryption_settings_read.key_encryption_key - return - - cls._schema_disk_encryption_settings_read = _schema_disk_encryption_settings_read = AAZObjectType() - - disk_encryption_settings_read = _schema_disk_encryption_settings_read - disk_encryption_settings_read.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - disk_encryption_settings_read.enabled = AAZBoolType() - disk_encryption_settings_read.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_encryption_settings_read.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_sub_resource_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_encryption_settings_read.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_sub_resource_read(key_encryption_key.source_vault) - - _schema.disk_encryption_key = cls._schema_disk_encryption_settings_read.disk_encryption_key - _schema.enabled = cls._schema_disk_encryption_settings_read.enabled - _schema.key_encryption_key = cls._schema_disk_encryption_settings_read.key_encryption_key - - _schema_instance_view_status_read = None - - @classmethod - def _build_schema_instance_view_status_read(cls, _schema): - if cls._schema_instance_view_status_read is not None: - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - return - - cls._schema_instance_view_status_read = _schema_instance_view_status_read = AAZObjectType() - - instance_view_status_read = _schema_instance_view_status_read - instance_view_status_read.code = AAZStrType() - instance_view_status_read.display_status = AAZStrType( - serialized_name="displayStatus", - ) - instance_view_status_read.level = AAZStrType() - instance_view_status_read.message = AAZStrType() - instance_view_status_read.time = AAZStrType() - - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - - _schema_managed_disk_parameters_read = None - - @classmethod - def _build_schema_managed_disk_parameters_read(cls, _schema): - if cls._schema_managed_disk_parameters_read is not None: - _schema.id = cls._schema_managed_disk_parameters_read.id - _schema.storage_account_type = cls._schema_managed_disk_parameters_read.storage_account_type - return - - cls._schema_managed_disk_parameters_read = _schema_managed_disk_parameters_read = AAZObjectType() - - managed_disk_parameters_read = _schema_managed_disk_parameters_read - managed_disk_parameters_read.id = AAZStrType() - managed_disk_parameters_read.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - _schema.id = cls._schema_managed_disk_parameters_read.id - _schema.storage_account_type = cls._schema_managed_disk_parameters_read.storage_account_type - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_virtual_hard_disk_read = None - - @classmethod - def _build_schema_virtual_hard_disk_read(cls, _schema): - if cls._schema_virtual_hard_disk_read is not None: - _schema.uri = cls._schema_virtual_hard_disk_read.uri - return - - cls._schema_virtual_hard_disk_read = _schema_virtual_hard_disk_read = AAZObjectType() - - virtual_hard_disk_read = _schema_virtual_hard_disk_read - virtual_hard_disk_read.uri = AAZStrType() - - _schema.uri = cls._schema_virtual_hard_disk_read.uri - - _schema_virtual_machine_extension_instance_view_read = None - - @classmethod - def _build_schema_virtual_machine_extension_instance_view_read(cls, _schema): - if cls._schema_virtual_machine_extension_instance_view_read is not None: - _schema.name = cls._schema_virtual_machine_extension_instance_view_read.name - _schema.statuses = cls._schema_virtual_machine_extension_instance_view_read.statuses - _schema.substatuses = cls._schema_virtual_machine_extension_instance_view_read.substatuses - _schema.type = cls._schema_virtual_machine_extension_instance_view_read.type - _schema.type_handler_version = cls._schema_virtual_machine_extension_instance_view_read.type_handler_version - return - - cls._schema_virtual_machine_extension_instance_view_read = _schema_virtual_machine_extension_instance_view_read = AAZObjectType() - - virtual_machine_extension_instance_view_read = _schema_virtual_machine_extension_instance_view_read - virtual_machine_extension_instance_view_read.name = AAZStrType() - virtual_machine_extension_instance_view_read.statuses = AAZListType() - virtual_machine_extension_instance_view_read.substatuses = AAZListType() - virtual_machine_extension_instance_view_read.type = AAZStrType() - virtual_machine_extension_instance_view_read.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - statuses = _schema_virtual_machine_extension_instance_view_read.statuses - statuses.Element = AAZObjectType() - cls._build_schema_instance_view_status_read(statuses.Element) - - substatuses = _schema_virtual_machine_extension_instance_view_read.substatuses - substatuses.Element = AAZObjectType() - cls._build_schema_instance_view_status_read(substatuses.Element) - - _schema.name = cls._schema_virtual_machine_extension_instance_view_read.name - _schema.statuses = cls._schema_virtual_machine_extension_instance_view_read.statuses - _schema.substatuses = cls._schema_virtual_machine_extension_instance_view_read.substatuses - _schema.type = cls._schema_virtual_machine_extension_instance_view_read.type - _schema.type_handler_version = cls._schema_virtual_machine_extension_instance_view_read.type_handler_version - - -__all__ = ["ListInstances"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_skus.py deleted file mode 100644 index 3a06a8c6971..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_list_skus.py +++ /dev/null @@ -1,200 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list-skus", -) -class ListSkus(AAZCommand): - """List SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/skus", "2017-12-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetsListSkus(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetsListSkus(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.capacity = AAZObjectType() - _element.resource_type = AAZStrType( - serialized_name="resourceType", - flags={"read_only": True}, - ) - _element.sku = AAZObjectType() - - capacity = cls._schema_on_200.value.Element.capacity - capacity.default_capacity = AAZIntType( - serialized_name="defaultCapacity", - flags={"read_only": True}, - ) - capacity.maximum = AAZIntType( - flags={"read_only": True}, - ) - capacity.minimum = AAZIntType( - flags={"read_only": True}, - ) - capacity.scale_type = AAZStrType( - serialized_name="scaleType", - flags={"read_only": True}, - ) - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_perform_maintenance.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_perform_maintenance.py deleted file mode 100644 index bfb1118bd1d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/_perform_maintenance.py +++ /dev/null @@ -1,242 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss perform-maintenance", -) -class PerformMaintenance(AAZCommand): - """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not eligible for perform maintenance will be failed. Please refer to best practices for more details: https://learn.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications - """ - - _aaz_info = { - "version": "2017-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/performmaintenance", "2017-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - id_part="name", - ) - - # define Arg Group "VmInstanceIDs" - - _args_schema = cls._args_schema - _args_schema.instance_ids = AAZListArg( - options=["--instance-ids"], - arg_group="VmInstanceIDs", - help="The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set.", - ) - - instance_ids = cls._args_schema.instance_ids - instance_ids.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetsPerformMaintenance(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 VirtualMachineScaleSetsPerformMaintenance(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-12-01", - 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": {"client_flatten": True}} - ) - _builder.set_prop("instanceIds", AAZListType, ".instance_ids") - - instance_ids = _builder.get(".instanceIds") - if instance_ids is not None: - instance_ids.set_elements(AAZStrType, ".") - - 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.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - error = cls._schema_on_200.error - error.code = AAZStrType() - error.details = AAZListType() - error.innererror = AAZObjectType() - error.message = AAZStrType() - error.target = AAZStrType() - - details = cls._schema_on_200.error.details - details.Element = AAZObjectType() - - _element = cls._schema_on_200.error.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = cls._schema_on_200.error.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - return cls._schema_on_200 - - -class _PerformMaintenanceHelper: - """Helper class for PerformMaintenance""" - - -__all__ = ["PerformMaintenance"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/__cmd_group.py deleted file mode 100644 index 9a043b70dae..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic", -) -class __CMDGroup(AAZCommandGroup): - """Manage network interfaces of a VMSS. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/__init__.py deleted file mode 100644 index f929fbbe945..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._list_vm_nics import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_list.py deleted file mode 100644 index 96947456a9c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_list.py +++ /dev/null @@ -1,800 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic list", -) -class List(AAZCommand): - """Get all network interfaces in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/networkinterfaces", "2016-03-30"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesListVirtualMachineScaleSetNetworkInterfaces(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesListVirtualMachineScaleSetNetworkInterfaces(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_list_vm_nics.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_list_vm_nics.py deleted file mode 100644 index d2611c73142..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_list_vm_nics.py +++ /dev/null @@ -1,809 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic list-vm-nics", -) -class ListVmNics(AAZCommand): - """Get information about all network interfaces in a virtual machine in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines/{}/networkinterfaces", "2016-03-30"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name.", - required=True, - ) - _args_schema.virtualmachine_index = AAZStrArg( - options=["--instance-id", "--virtualmachine-index"], - help="The virtual machine index.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfaces(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfaces(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - **self.serialize_url_param( - "virtualmachineIndex", self.ctx.args.virtualmachine_index, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListVmNicsHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListVmNicsHelper: - """Helper class for ListVmNics""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["ListVmNics"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_show.py deleted file mode 100644 index 62fe3196cd3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/nic/_show.py +++ /dev/null @@ -1,819 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic show", -) -class Show(AAZCommand): - """Get the specified network interface in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines/{}/networkinterfaces/{}", "2016-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.network_interface_name = AAZStrArg( - options=["-n", "--name", "--network-interface-name"], - help="The network interface (NIC).", - required=True, - id_part="child_name_2", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name.", - required=True, - id_part="name", - ) - _args_schema.virtualmachine_index = AAZStrArg( - options=["--instance-id", "--virtualmachine-index"], - help="The virtual machine index.", - required=True, - id_part="child_name_1", - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGetVirtualMachineScaleSetNetworkInterface(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 NetworkInterfacesGetVirtualMachineScaleSetNetworkInterface(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.network_interface_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - **self.serialize_url_param( - "virtualmachineIndex", self.ctx.args.virtualmachine_index, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/__cmd_group.py deleted file mode 100644 index 8cfa2e80689..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade", -) -class __CMDGroup(AAZCommandGroup): - """Manage rolling upgrades. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/__init__.py deleted file mode 100644 index c1d51771410..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._cancel import * -from ._get_latest import * -from ._start import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_cancel.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_cancel.py deleted file mode 100644 index 73ecd2f9844..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_cancel.py +++ /dev/null @@ -1,148 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade cancel", -) -class Cancel(AAZCommand): - """Cancel the current virtual machine scale set rolling upgrade. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/rollingupgrades/cancel", "2022-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetRollingUpgradesCancel(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetRollingUpgradesCancel(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _CancelHelper: - """Helper class for Cancel""" - - -__all__ = ["Cancel"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_get_latest.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_get_latest.py deleted file mode 100644 index 1cc31960367..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_get_latest.py +++ /dev/null @@ -1,290 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade get-latest", -) -class GetLatest(AAZCommand): - """Get the status of the latest virtual machine scale set rolling upgrade. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/rollingupgrades/latest", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetRollingUpgradesGetLatest(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 VirtualMachineScaleSetRollingUpgradesGetLatest(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.error = AAZObjectType() - _GetLatestHelper._build_schema_api_error_read(properties.error) - properties.policy = AAZObjectType() - properties.progress = AAZObjectType() - properties.running_status = AAZObjectType( - serialized_name="runningStatus", - ) - - policy = cls._schema_on_200.properties.policy - policy.enable_cross_zone_upgrade = AAZBoolType( - serialized_name="enableCrossZoneUpgrade", - ) - policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - policy.max_surge = AAZBoolType( - serialized_name="maxSurge", - ) - policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - policy.prioritize_unhealthy_instances = AAZBoolType( - serialized_name="prioritizeUnhealthyInstances", - ) - policy.rollback_failed_instances_on_policy_breach = AAZBoolType( - serialized_name="rollbackFailedInstancesOnPolicyBreach", - ) - - progress = cls._schema_on_200.properties.progress - progress.failed_instance_count = AAZIntType( - serialized_name="failedInstanceCount", - flags={"read_only": True}, - ) - progress.in_progress_instance_count = AAZIntType( - serialized_name="inProgressInstanceCount", - flags={"read_only": True}, - ) - progress.pending_instance_count = AAZIntType( - serialized_name="pendingInstanceCount", - flags={"read_only": True}, - ) - progress.successful_instance_count = AAZIntType( - serialized_name="successfulInstanceCount", - flags={"read_only": True}, - ) - - running_status = cls._schema_on_200.properties.running_status - running_status.code = AAZStrType( - flags={"read_only": True}, - ) - running_status.last_action = AAZStrType( - serialized_name="lastAction", - flags={"read_only": True}, - ) - running_status.last_action_time = AAZStrType( - serialized_name="lastActionTime", - flags={"read_only": True}, - ) - running_status.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _GetLatestHelper: - """Helper class for GetLatest""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType() - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - -__all__ = ["GetLatest"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_start.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_start.py deleted file mode 100644 index 816e0ad19d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2019_03_01_hybrid/vmss/rolling_upgrade/_start.py +++ /dev/null @@ -1,148 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade start", -) -class Start(AAZCommand): - """Start a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version. Instances which are already running the latest available OS version are not affected. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/osrollingupgrade", "2022-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetRollingUpgradesStartOSUpgrade(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetRollingUpgradesStartOSUpgrade(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _StartHelper: - """Helper class for Start""" - - -__all__ = ["Start"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/__init__.py deleted file mode 100644 index f6acc11aa4e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 - diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/__cmd_group.py deleted file mode 100644 index a10530cf097..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/__cmd_group.py deleted file mode 100644 index 58d1554a9a5..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity reservation. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/__cmd_group.py deleted file mode 100644 index 84dd1dd45a2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation group", -) -class __CMDGroup(AAZCommandGroup): - """Manage capacity reservation group. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/__init__.py deleted file mode 100644 index d63ae5a6fc9..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/_list.py deleted file mode 100644 index 0d8796f5f6e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/capacity/reservation/group/_list.py +++ /dev/null @@ -1,519 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "capacity reservation group list", -) -class List(AAZCommand): - """List the capacity reservation groups. - - :example: List capacity reservation groups - az capacity reservation group list -g rg - - :example: List the capacity reservation groups containing VM instances and VMSS instance which are associated to capacity reservation group - az capacity reservation group list -g rg --vm-instance --vmss-instance - """ - - _aaz_info = { - "version": "2024-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/capacityreservationgroups", "2024-03-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/capacityreservationgroups", "2024-03-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource Ids which are associated to capacity reservation group in the response.", - enum={"virtualMachineScaleSetVMs/$ref": "virtualMachineScaleSetVMs/$ref", "virtualMachines/$ref": "virtualMachines/$ref"}, - ) - _args_schema.resource_ids_only = AAZStrArg( - options=["--resource-ids-only"], - help="The query option to fetch capacity reservation group resource Ids. 'CreatedInSubscription' enables fetching resource Ids for all capacity reservation group resources created in the subscription. 'SharedWithSubscription' enables fetching resource Ids for all capacity reservation group resources shared with the subscription. 'All' enables fetching resource Ids for all capacity reservation group resources shared with the subscription and created in the subscription.", - enum={"All": "All", "CreatedInSubscription": "CreatedInSubscription", "SharedWithSubscription": "SharedWithSubscription"}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.CapacityReservationGroupsListBySubscription(ctx=self.ctx)() - if condition_1: - self.CapacityReservationGroupsListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class CapacityReservationGroupsListBySubscription(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.Compute/capacityReservationGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "resourceIdsOnly", self.ctx.args.resource_ids_only, - ), - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - flags={"read_only": True}, - ) - properties.sharing_profile = AAZObjectType( - serialized_name="sharingProfile", - ) - properties.virtual_machines_associated = AAZListType( - serialized_name="virtualMachinesAssociated", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.capacity_reservations - capacity_reservations.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(capacity_reservations.Element) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - instance_view.shared_subscription_ids = AAZListType( - serialized_name="sharedSubscriptionIds", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations - capacity_reservations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.statuses = AAZListType() - _element.utilization_info = AAZObjectType( - serialized_name="utilizationInfo", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - utilization_info = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info - utilization_info.current_capacity = AAZIntType( - serialized_name="currentCapacity", - flags={"read_only": True}, - ) - utilization_info.virtual_machines_allocated = AAZListType( - serialized_name="virtualMachinesAllocated", - flags={"read_only": True}, - ) - - virtual_machines_allocated = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info.virtual_machines_allocated - virtual_machines_allocated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_allocated.Element) - - shared_subscription_ids = cls._schema_on_200.value.Element.properties.instance_view.shared_subscription_ids - shared_subscription_ids.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(shared_subscription_ids.Element) - - sharing_profile = cls._schema_on_200.value.Element.properties.sharing_profile - sharing_profile.subscription_ids = AAZListType( - serialized_name="subscriptionIds", - ) - - subscription_ids = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids - subscription_ids.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids.Element - _element.id = AAZStrType() - - virtual_machines_associated = cls._schema_on_200.value.Element.properties.virtual_machines_associated - virtual_machines_associated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_associated.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class CapacityReservationGroupsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2024-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - flags={"read_only": True}, - ) - properties.sharing_profile = AAZObjectType( - serialized_name="sharingProfile", - ) - properties.virtual_machines_associated = AAZListType( - serialized_name="virtualMachinesAssociated", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.capacity_reservations - capacity_reservations.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(capacity_reservations.Element) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.capacity_reservations = AAZListType( - serialized_name="capacityReservations", - flags={"read_only": True}, - ) - instance_view.shared_subscription_ids = AAZListType( - serialized_name="sharedSubscriptionIds", - flags={"read_only": True}, - ) - - capacity_reservations = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations - capacity_reservations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.statuses = AAZListType() - _element.utilization_info = AAZObjectType( - serialized_name="utilizationInfo", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - utilization_info = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info - utilization_info.current_capacity = AAZIntType( - serialized_name="currentCapacity", - flags={"read_only": True}, - ) - utilization_info.virtual_machines_allocated = AAZListType( - serialized_name="virtualMachinesAllocated", - flags={"read_only": True}, - ) - - virtual_machines_allocated = cls._schema_on_200.value.Element.properties.instance_view.capacity_reservations.Element.utilization_info.virtual_machines_allocated - virtual_machines_allocated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_allocated.Element) - - shared_subscription_ids = cls._schema_on_200.value.Element.properties.instance_view.shared_subscription_ids - shared_subscription_ids.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(shared_subscription_ids.Element) - - sharing_profile = cls._schema_on_200.value.Element.properties.sharing_profile - sharing_profile.subscription_ids = AAZListType( - serialized_name="subscriptionIds", - ) - - subscription_ids = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids - subscription_ids.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.sharing_profile.subscription_ids.Element - _element.id = AAZStrType() - - virtual_machines_associated = cls._schema_on_200.value.Element.properties.virtual_machines_associated - virtual_machines_associated.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read_only_read(virtual_machines_associated.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_sub_resource_read_only_read = None - - @classmethod - def _build_schema_sub_resource_read_only_read(cls, _schema): - if cls._schema_sub_resource_read_only_read is not None: - _schema.id = cls._schema_sub_resource_read_only_read.id - return - - cls._schema_sub_resource_read_only_read = _schema_sub_resource_read_only_read = AAZObjectType() - - sub_resource_read_only_read = _schema_sub_resource_read_only_read - sub_resource_read_only_read.id = AAZStrType( - flags={"read_only": True}, - ) - - _schema.id = cls._schema_sub_resource_read_only_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/__cmd_group.py deleted file mode 100644 index ef273230237..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/__cmd_group.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk", -) -class __CMDGroup(AAZCommandGroup): - """Manage Azure Managed Disks. - - Azure Virtual Machines use disks as a place to store an operating system, applications, and data. All Azure virtual machines have at least two disks: An operating system disk, and a temporary disk. The operating system disk is created from an image, and both the operating system disk and the image are actually virtual hard disks (VHDs) stored in an Azure storage account. Virtual machines also can have one or more data disks, that are also stored as VHDs. - Azure Unmanaged Data Disks have a maximum size of 4095 GB. To use disks larger than 4095 GB use [Azure Managed Disks](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview) - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/__init__.py deleted file mode 100644 index 59700973595..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._grant_access import * -from ._list import * -from ._revoke_access import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_create.py deleted file mode 100644 index 34d27e63e14..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_create.py +++ /dev/null @@ -1,643 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk create", -) -class Create(AAZCommand): - """Create a managed disk. - - :example: Create a managed disk by importing from a blob uri. - az disk create -g MyResourceGroup -n MyDisk --source https://vhd1234.blob.core.windows.net/vhds/osdisk1234.vhd - - :example: Create an empty managed disk. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 - - :example: Create an empty managed disk with bursting enabled. - az disk create -g MyResourceGroup -n MyDisk --size-gb 1024 --location centraluseuap --enable-bursting - - :example: Create a managed disk by copying an existing disk or snapshot. - az disk create -g MyResourceGroup -n MyDisk2 --source MyDisk - - :example: Create a disk in an availability zone in the region of "East US 2". - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --location eastus2 --zone 1 - - :example: Create a disk from image. - az disk create -g MyResourceGroup -n MyDisk --image-reference Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest - - :example: Create a disk from the OS Disk of a compute gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.0.0 - - :example: Create a disk from the OS Disk of the latest version in a compute gallery image. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage - - :example: Create a disk from the OS Disk of a shared gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /SharedGalleries/sharedGalleryUniqueName/Images/imageName/Versions/1.0.0 - - :example: Create a disk from the OS Disk of a community gallery image version. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /CommunityGalleries/communityGalleryPublicGalleryName/Images/imageName/Versions/1.0.0 - - :example: Create a disk from the Data Disk of a gallery image. - az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.0.0 --gallery-image-reference-lun 0 - - :example: Create a disk with total number of IOPS and total throughput (MBps) limitation. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --sku UltraSSD_LRS --disk-iops-read-only 200 --disk-mbps-read-only 30 - - :example: Create a disk and specify maximum number of VMs that can attach to the disk at the same time. - az disk create -g MyResourceGroup -n MyDisk --size-gb 256 --max-shares 2 -l centraluseuap - - :example: Create a disk and associate it with a disk access resource. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Create a disk from the blob URI for VM guest state VHD. - az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --security-data-uri GuestStateDiskVhdUri --security-type TrustedLaunch --hyper-v-generation V2 - - :example: Create a standard disk for uploading blobs. - az disk create -g MyResourceGroup -n MyDisk --upload-size-bytes 20972032 --upload-type Upload - - :example: Create an OS disk for uploading along with VM guest state. - az disk create -g MyResourceGroup -n MyDisk --upload-size-bytes 20972032 --upload-type UploadWithSecurityData --security-type TrustedLaunch --hyper-v-generation V2 - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Disk" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Disk", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - arg_group="Disk", - help="The disks sku name. Can be Standard_LRS, Premium_LRS, StandardSSD_LRS, UltraSSD_LRS, Premium_ZRS, StandardSSD_ZRS, or PremiumV2_LRS.", - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Disk", - help="Resource tags", - ) - _args_schema.zones = AAZListArg( - options=["--zones"], - arg_group="Disk", - help="The Logical zone list for Disk.", - ) - - sku = cls._args_schema.sku - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - enum={"Premium_LRS": "Premium_LRS", "StandardSSD_LRS": "StandardSSD_LRS", "Standard_LRS": "Standard_LRS", "UltraSSD_LRS": "UltraSSD_LRS"}, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - zones = cls._args_schema.zones - zones.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.creation_data = AAZObjectArg( - options=["--creation-data"], - arg_group="Properties", - help="Disk source information. CreationData information cannot be changed after the disk has been created.", - ) - _args_schema.disk_iops_read_write = AAZIntArg( - options=["--disk-iops-read-write"], - arg_group="Properties", - help="The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.", - ) - _args_schema.disk_m_bps_read_write = AAZIntArg( - options=["--disk-m-bps-read-write"], - arg_group="Properties", - help="The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.", - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["--disk-size-gb"], - arg_group="Properties", - help="If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.", - ) - _args_schema.encryption = AAZObjectArg( - options=["--encryption"], - arg_group="Properties", - help="Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.", - ) - _args_schema.hyper_v_generation = AAZStrArg( - options=["--hyper-v-generation"], - arg_group="Properties", - help="The hypervisor generation of the Virtual Machine. Applicable to OS disks only.", - enum={"V1": "V1", "V2": "V2"}, - ) - _args_schema.os_type = AAZStrArg( - options=["--os-type"], - arg_group="Properties", - help="The Operating System type.", - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - - creation_data = cls._args_schema.creation_data - creation_data.create_option = AAZStrArg( - options=["create-option"], - help="This enumerates the possible sources of a disk's creation.", - required=True, - enum={"Attach": "Attach", "Copy": "Copy", "Empty": "Empty", "FromImage": "FromImage", "Import": "Import", "Restore": "Restore", "Upload": "Upload"}, - ) - creation_data.image_reference = AAZObjectArg( - options=["image-reference"], - help="Disk source information for PIR or user images.", - ) - creation_data.source_resource_id = AAZStrArg( - options=["source-resource-id"], - help="If createOption is Copy, this is the ARM id of the source snapshot or disk.", - ) - creation_data.source_uri = AAZStrArg( - options=["source-uri"], - help="If createOption is Import, this is the URI of a blob to be imported into a managed disk.", - ) - creation_data.storage_account_id = AAZStrArg( - options=["storage-account-id"], - help="Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk.", - ) - creation_data.upload_size_bytes = AAZIntArg( - options=["upload-size-bytes"], - help="If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer).", - ) - - image_reference = cls._args_schema.creation_data.image_reference - image_reference.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository or user image reference.", - ) - image_reference.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - ) - - encryption = cls._args_schema.encryption - encryption.disk_encryption_set_id = AAZStrArg( - options=["disk-encryption-set-id"], - help="ResourceId of the disk encryption set to use for enabling encryption at rest.", - ) - encryption.type = AAZStrArg( - options=["type"], - help="The type of key used to encrypt the data of the disk.", - enum={"EncryptionAtRestWithCustomerKey": "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformKey": "EncryptionAtRestWithPlatformKey"}, - ) - return cls._args_schema - - _args_source_vault_create = None - - @classmethod - def _build_args_source_vault_create(cls, _schema): - if cls._args_source_vault_create is not None: - _schema.id = cls._args_source_vault_create.id - return - - cls._args_source_vault_create = AAZObjectArg() - - source_vault_create = cls._args_source_vault_create - source_vault_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_source_vault_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.DisksCreateOrUpdate(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 DisksCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-07-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - _builder.set_prop("tags", AAZDictType, ".tags") - _builder.set_prop("zones", AAZListType, ".zones") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("creationData", AAZObjectType, ".creation_data", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("diskIOPSReadWrite", AAZIntType, ".disk_iops_read_write") - properties.set_prop("diskMBpsReadWrite", AAZIntType, ".disk_m_bps_read_write") - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryption", AAZObjectType, ".encryption") - properties.set_prop("hyperVGeneration", AAZStrType, ".hyper_v_generation") - properties.set_prop("osType", AAZStrType, ".os_type") - - creation_data = _builder.get(".properties.creationData") - if creation_data is not None: - creation_data.set_prop("createOption", AAZStrType, ".create_option", typ_kwargs={"flags": {"required": True}}) - creation_data.set_prop("imageReference", AAZObjectType, ".image_reference") - creation_data.set_prop("sourceResourceId", AAZStrType, ".source_resource_id") - creation_data.set_prop("sourceUri", AAZStrType, ".source_uri") - creation_data.set_prop("storageAccountId", AAZStrType, ".storage_account_id") - creation_data.set_prop("uploadSizeBytes", AAZIntType, ".upload_size_bytes") - - image_reference = _builder.get(".properties.creationData.imageReference") - if image_reference is not None: - image_reference.set_prop("id", AAZStrType, ".id") - image_reference.set_prop("lun", AAZIntType, ".lun") - - encryption = _builder.get(".properties.encryption") - if encryption is not None: - encryption.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - encryption.set_prop("type", AAZStrType, ".type") - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".name") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - zones = _builder.get(".zones") - if zones is not None: - zones.set_elements(AAZStrType, ".") - - 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() - _CreateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_source_vault_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_disk_read = None - - @classmethod - def _build_schema_disk_read(cls, _schema): - if cls._schema_disk_read is not None: - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - return - - cls._schema_disk_read = _schema_disk_read = AAZObjectType() - - disk_read = _schema_disk_read - disk_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_read.location = AAZStrType( - flags={"required": True}, - ) - disk_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - disk_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_read.sku = AAZObjectType() - disk_read.tags = AAZDictType() - disk_read.type = AAZStrType( - flags={"read_only": True}, - ) - disk_read.zones = AAZListType() - - properties = _schema_disk_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - properties.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.disk_state = AAZStrType( - serialized_name="diskState", - flags={"read_only": True}, - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = _schema_disk_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = _schema_disk_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption = _schema_disk_read.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = _schema_disk_read.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = _schema_disk_read.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_disk_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_disk_read.tags - tags.Element = AAZStrType() - - zones = _schema_disk_read.zones - zones.Element = AAZStrType() - - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_delete.py deleted file mode 100644 index db6adfb7e27..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_delete.py +++ /dev/null @@ -1,163 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete a managed disk. - - :example: Delete a managed disk. - az disk delete --name MyManagedDisk --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class DisksDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_grant_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_grant_access.py deleted file mode 100644 index dfa8fba02b3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_grant_access.py +++ /dev/null @@ -1,221 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk grant-access", -) -class GrantAccess(AAZCommand): - """Grant a resource access to a managed disk. - - :example: Grant a resource read access to a managed disk. - az disk grant-access --access-level Read --duration-in-seconds 3600 --name MyManagedDisk --resource-group MyResourceGroup - - :example: Grant a resource read access to a disk to generate access SAS and security data access SAS - az disk grant-access --access-level Read --duration-in-seconds 3600 --name MyDisk --resource-group MyResourceGroup --secure-vm-guest-state-sas - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}/begingetaccess", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "GrantAccessData" - - _args_schema = cls._args_schema - _args_schema.access_level = AAZStrArg( - options=["--access", "--access-level"], - arg_group="GrantAccessData", - help="Access level.", - required=True, - default="Read", - enum={"None": "None", "Read": "Read", "Write": "Write"}, - ) - _args_schema.duration_in_seconds = AAZIntArg( - options=["--duration-in-seconds"], - arg_group="GrantAccessData", - help="Time duration in seconds until the SAS access expires.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksGrantAccess(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 DisksGrantAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess", - **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( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-07-01", - 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("access", AAZStrType, ".access_level", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("durationInSeconds", AAZIntType, ".duration_in_seconds", 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.access_sas = AAZStrType( - serialized_name="accessSAS", - flags={"read_only": True}, - ) - - return cls._schema_on_200 - - -class _GrantAccessHelper: - """Helper class for GrantAccess""" - - -__all__ = ["GrantAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_list.py deleted file mode 100644 index 01c7b2e5aec..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_list.py +++ /dev/null @@ -1,594 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk list", -) -class List(AAZCommand): - """List managed disks. - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/disks", "2019-07-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks", "2019-07-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.DisksList(ctx=self.ctx)() - if condition_1: - self.DisksListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class DisksList(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.Compute/disks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - properties.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.disk_state = AAZStrType( - serialized_name="diskState", - flags={"read_only": True}, - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption = cls._schema_on_200.value.Element.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType( - flags={"required": True}, - ) - - encryption_settings_collection = cls._schema_on_200.value.Element.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class DisksListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - properties.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.disk_state = AAZStrType( - serialized_name="diskState", - flags={"read_only": True}, - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption = cls._schema_on_200.value.Element.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType( - flags={"required": True}, - ) - - encryption_settings_collection = cls._schema_on_200.value.Element.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_revoke_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_revoke_access.py deleted file mode 100644 index a8eec3ee95f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_revoke_access.py +++ /dev/null @@ -1,153 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk revoke-access", -) -class RevokeAccess(AAZCommand): - """Revoke a resource's read access to a managed disk. - - :example: Revoke a resource's read access to a managed disk. - az disk revoke-access --ids $id - - :example: Revoke a resource's read access to a managed disk. - az disk revoke-access --name MyManagedDisk --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}/endgetaccess", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DisksRevokeAccess(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class DisksRevokeAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess", - **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( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _RevokeAccessHelper: - """Helper class for RevokeAccess""" - - -__all__ = ["RevokeAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_show.py deleted file mode 100644 index d66fb7a7dc6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_show.py +++ /dev/null @@ -1,334 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk show", -) -class Show(AAZCommand): - """Get information about a disk. - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2019-07-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(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 DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.zones = AAZListType() - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - properties.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.disk_state = AAZStrType( - serialized_name="diskState", - flags={"read_only": True}, - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption = cls._schema_on_200.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = cls._schema_on_200.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_update.py deleted file mode 100644 index c35600bbb12..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_update.py +++ /dev/null @@ -1,906 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk update", -) -class Update(AAZCommand): - """Update a managed disk. - - :example: Update a managed disk and associate it with a disk access resource. - az disk update --name MyManagedDisk --resource-group MyResourceGroup --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Update a managed disk. - az disk update --name MyManagedDisk --resource-group MyResourceGroup --size-gb 20 - """ - - _aaz_info = { - "version": "2023-04-02", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2023-04-02"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.sku = AAZStrArg( - options=["--sku"], - help="Underlying storage SKU.", - nullable=True, - enum={"PremiumV2_LRS": "PremiumV2_LRS", "Premium_LRS": "Premium_LRS", "Premium_ZRS": "Premium_ZRS", "StandardSSD_LRS": "StandardSSD_LRS", "StandardSSD_ZRS": "StandardSSD_ZRS", "Standard_LRS": "Standard_LRS", "UltraSSD_LRS": "UltraSSD_LRS"}, - ) - - # define Arg Group "Disk" - - # define Arg Group "Encryption" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_id = AAZStrArg( - options=["--disk-encryption-set-id"], - arg_group="Encryption", - help="ResourceId of the disk encryption set to use for enabling encryption at rest.", - nullable=True, - ) - _args_schema.encryption_type = AAZStrArg( - options=["--encryption-type"], - arg_group="Encryption", - help={"short-summary": "Encryption type.", "long-summary": "EncryptionAtRestWithPlatformKey: Disk is encrypted with XStore managed key at rest. It is the default encryption type. EncryptionAtRestWithCustomerKey: Disk is encrypted with Customer managed key at rest."}, - nullable=True, - enum={"EncryptionAtRestWithCustomerKey": "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys": "EncryptionAtRestWithPlatformAndCustomerKeys", "EncryptionAtRestWithPlatformKey": "EncryptionAtRestWithPlatformKey"}, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.bursting_enabled = AAZBoolArg( - options=["--enable-bursting", "--bursting-enabled"], - arg_group="Properties", - help="Enable on-demand bursting beyond the provisioned performance target of the disk. On-demand bursting is disabled by default, and it does not apply to Ultra disks.", - nullable=True, - ) - _args_schema.data_access_auth_mode = AAZStrArg( - options=["--data-access-auth-mode"], - arg_group="Properties", - help="Specify the auth mode when exporting or uploading to a disk or snapshot.", - nullable=True, - enum={"AzureActiveDirectory": "AzureActiveDirectory", "None": "None"}, - ) - _args_schema.disk_access_id = AAZStrArg( - options=["--disk-access-id"], - arg_group="Properties", - help="ARM id of the DiskAccess resource for using private endpoints on disks.", - nullable=True, - ) - _args_schema.disk_iops_read_only = AAZIntArg( - options=["--disk-iops-read-only"], - arg_group="Properties", - help="The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes.", - nullable=True, - ) - _args_schema.disk_iops_read_write = AAZIntArg( - options=["--disk-iops-read-write"], - arg_group="Properties", - help="The number of IOPS allowed for this disk; only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes.", - nullable=True, - ) - _args_schema.disk_mbps_read_only = AAZIntArg( - options=["--disk-mbps-read-only"], - arg_group="Properties", - help="The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.", - nullable=True, - ) - _args_schema.disk_mbps_read_write = AAZIntArg( - options=["--disk-mbps-read-write"], - arg_group="Properties", - help="The bandwidth allowed for this disk; only settable for UltraSSD disks. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10.", - nullable=True, - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["-z", "--size-gb", "--disk-size-gb"], - arg_group="Properties", - help="Size in GB. Max size: 4095 GB (certain preview disks can be larger).", - nullable=True, - ) - _args_schema.max_shares = AAZIntArg( - options=["--max-shares"], - arg_group="Properties", - help="The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time.", - nullable=True, - ) - _args_schema.network_access_policy = AAZStrArg( - options=["--network-access-policy"], - arg_group="Properties", - help="Policy for accessing the disk via network.", - nullable=True, - enum={"AllowAll": "AllowAll", "AllowPrivate": "AllowPrivate", "DenyAll": "DenyAll"}, - ) - _args_schema.public_network_access = AAZStrArg( - options=["--public-network-access"], - arg_group="Properties", - help="Customers can set on Managed Disks or Snapshots to control the export policy on the disk.", - is_preview=True, - nullable=True, - enum={"Disabled": "Disabled", "Enabled": "Enabled"}, - ) - - # define Arg Group "SupportedCapabilities" - - _args_schema = cls._args_schema - _args_schema.accelerated_network = AAZBoolArg( - options=["--accelerated-network"], - arg_group="SupportedCapabilities", - help="Customers can set on Managed Disks or Snapshots to enable the accelerated networking if the OS disk image support.", - is_preview=True, - nullable=True, - ) - _args_schema.architecture = AAZStrArg( - options=["--architecture"], - arg_group="SupportedCapabilities", - help="CPU architecture supported by an OS disk.", - nullable=True, - enum={"Arm64": "Arm64", "x64": "x64"}, - ) - return cls._args_schema - - _args_image_disk_reference_update = None - - @classmethod - def _build_args_image_disk_reference_update(cls, _schema): - if cls._args_image_disk_reference_update is not None: - _schema.community_gallery_image_id = cls._args_image_disk_reference_update.community_gallery_image_id - _schema.id = cls._args_image_disk_reference_update.id - _schema.lun = cls._args_image_disk_reference_update.lun - _schema.shared_gallery_image_id = cls._args_image_disk_reference_update.shared_gallery_image_id - return - - cls._args_image_disk_reference_update = AAZObjectArg( - nullable=True, - ) - - image_disk_reference_update = cls._args_image_disk_reference_update - image_disk_reference_update.community_gallery_image_id = AAZStrArg( - options=["community-gallery-image-id"], - help="A relative uri containing a community Azure Compute Gallery image reference.", - nullable=True, - ) - image_disk_reference_update.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository, user image, or Azure Compute Gallery image reference.", - nullable=True, - ) - image_disk_reference_update.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - nullable=True, - ) - image_disk_reference_update.shared_gallery_image_id = AAZStrArg( - options=["shared-gallery-image-id"], - help="A relative uri containing a direct shared Azure Compute Gallery image reference.", - nullable=True, - ) - - _schema.community_gallery_image_id = cls._args_image_disk_reference_update.community_gallery_image_id - _schema.id = cls._args_image_disk_reference_update.id - _schema.lun = cls._args_image_disk_reference_update.lun - _schema.shared_gallery_image_id = cls._args_image_disk_reference_update.shared_gallery_image_id - - _args_source_vault_update = None - - @classmethod - def _build_args_source_vault_update(cls, _schema): - if cls._args_source_vault_update is not None: - _schema.id = cls._args_source_vault_update.id - return - - cls._args_source_vault_update = AAZObjectArg() - - source_vault_update = cls._args_source_vault_update - source_vault_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_source_vault_update.id - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.DisksCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - class DisksCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_disk_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("burstingEnabled", AAZBoolType, ".bursting_enabled") - properties.set_prop("dataAccessAuthMode", AAZStrType, ".data_access_auth_mode") - properties.set_prop("diskAccessId", AAZStrType, ".disk_access_id") - properties.set_prop("diskIOPSReadOnly", AAZIntType, ".disk_iops_read_only") - properties.set_prop("diskIOPSReadWrite", AAZIntType, ".disk_iops_read_write") - properties.set_prop("diskMBpsReadOnly", AAZIntType, ".disk_mbps_read_only") - properties.set_prop("diskMBpsReadWrite", AAZIntType, ".disk_mbps_read_write") - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryption", AAZObjectType) - properties.set_prop("maxShares", AAZIntType, ".max_shares") - properties.set_prop("networkAccessPolicy", AAZStrType, ".network_access_policy") - properties.set_prop("publicNetworkAccess", AAZStrType, ".public_network_access") - properties.set_prop("supportedCapabilities", AAZObjectType) - - encryption = _builder.get(".properties.encryption") - if encryption is not None: - encryption.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - encryption.set_prop("type", AAZStrType, ".encryption_type") - - supported_capabilities = _builder.get(".properties.supportedCapabilities") - if supported_capabilities is not None: - supported_capabilities.set_prop("acceleratedNetwork", AAZBoolType, ".accelerated_network") - supported_capabilities.set_prop("architecture", AAZStrType, ".architecture") - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".sku") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_image_disk_reference_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("communityGalleryImageId", AAZStrType, ".community_gallery_image_id") - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("lun", AAZIntType, ".lun") - _builder.set_prop("sharedGalleryImageId", AAZStrType, ".shared_gallery_image_id") - - @classmethod - def _build_schema_source_vault_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_disk_read = None - - @classmethod - def _build_schema_disk_read(cls, _schema): - if cls._schema_disk_read is not None: - _schema.extended_location = cls._schema_disk_read.extended_location - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.managed_by_extended = cls._schema_disk_read.managed_by_extended - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - return - - cls._schema_disk_read = _schema_disk_read = AAZObjectType() - - disk_read = _schema_disk_read - disk_read.extended_location = AAZObjectType( - serialized_name="extendedLocation", - ) - disk_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_read.location = AAZStrType( - flags={"required": True}, - ) - disk_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - disk_read.managed_by_extended = AAZListType( - serialized_name="managedByExtended", - flags={"read_only": True}, - ) - disk_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_read.sku = AAZObjectType() - disk_read.tags = AAZDictType() - disk_read.type = AAZStrType( - flags={"read_only": True}, - ) - disk_read.zones = AAZListType() - - extended_location = _schema_disk_read.extended_location - extended_location.name = AAZStrType() - extended_location.type = AAZStrType() - - managed_by_extended = _schema_disk_read.managed_by_extended - managed_by_extended.Element = AAZStrType() - - properties = _schema_disk_read.properties - properties.last_ownership_update_time = AAZStrType( - serialized_name="LastOwnershipUpdateTime", - flags={"read_only": True}, - ) - properties.bursting_enabled = AAZBoolType( - serialized_name="burstingEnabled", - ) - properties.bursting_enabled_time = AAZStrType( - serialized_name="burstingEnabledTime", - flags={"read_only": True}, - ) - properties.completion_percent = AAZFloatType( - serialized_name="completionPercent", - ) - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.data_access_auth_mode = AAZStrType( - serialized_name="dataAccessAuthMode", - ) - properties.disk_access_id = AAZStrType( - serialized_name="diskAccessId", - ) - properties.disk_iops_read_only = AAZIntType( - serialized_name="diskIOPSReadOnly", - ) - properties.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - properties.disk_m_bps_read_only = AAZIntType( - serialized_name="diskMBpsReadOnly", - ) - properties.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.disk_state = AAZStrType( - serialized_name="diskState", - flags={"read_only": True}, - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.max_shares = AAZIntType( - serialized_name="maxShares", - ) - properties.network_access_policy = AAZStrType( - serialized_name="networkAccessPolicy", - ) - properties.optimized_for_frequent_attach = AAZBoolType( - serialized_name="optimizedForFrequentAttach", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.property_updates_in_progress = AAZObjectType( - serialized_name="propertyUpdatesInProgress", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.public_network_access = AAZStrType( - serialized_name="publicNetworkAccess", - ) - properties.purchase_plan = AAZObjectType( - serialized_name="purchasePlan", - ) - properties.security_profile = AAZObjectType( - serialized_name="securityProfile", - ) - properties.share_info = AAZListType( - serialized_name="shareInfo", - flags={"read_only": True}, - ) - properties.supported_capabilities = AAZObjectType( - serialized_name="supportedCapabilities", - ) - properties.supports_hibernation = AAZBoolType( - serialized_name="supportsHibernation", - ) - properties.tier = AAZStrType() - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = _schema_disk_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.elastic_san_resource_id = AAZStrType( - serialized_name="elasticSanResourceId", - ) - creation_data.gallery_image_reference = AAZObjectType( - serialized_name="galleryImageReference", - ) - cls._build_schema_image_disk_reference_read(creation_data.gallery_image_reference) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - cls._build_schema_image_disk_reference_read(creation_data.image_reference) - creation_data.logical_sector_size = AAZIntType( - serialized_name="logicalSectorSize", - ) - creation_data.performance_plus = AAZBoolType( - serialized_name="performancePlus", - ) - creation_data.security_data_uri = AAZStrType( - serialized_name="securityDataUri", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - encryption = _schema_disk_read.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = _schema_disk_read.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = _schema_disk_read.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_read.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - property_updates_in_progress = _schema_disk_read.properties.property_updates_in_progress - property_updates_in_progress.target_tier = AAZStrType( - serialized_name="targetTier", - ) - - purchase_plan = _schema_disk_read.properties.purchase_plan - purchase_plan.name = AAZStrType( - flags={"required": True}, - ) - purchase_plan.product = AAZStrType( - flags={"required": True}, - ) - purchase_plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - purchase_plan.publisher = AAZStrType( - flags={"required": True}, - ) - - security_profile = _schema_disk_read.properties.security_profile - security_profile.secure_vm_disk_encryption_set_id = AAZStrType( - serialized_name="secureVMDiskEncryptionSetId", - ) - security_profile.security_type = AAZStrType( - serialized_name="securityType", - ) - - share_info = _schema_disk_read.properties.share_info - share_info.Element = AAZObjectType() - - _element = _schema_disk_read.properties.share_info.Element - _element.vm_uri = AAZStrType( - serialized_name="vmUri", - flags={"read_only": True}, - ) - - supported_capabilities = _schema_disk_read.properties.supported_capabilities - supported_capabilities.accelerated_network = AAZBoolType( - serialized_name="acceleratedNetwork", - ) - supported_capabilities.architecture = AAZStrType() - supported_capabilities.disk_controller_types = AAZStrType( - serialized_name="diskControllerTypes", - ) - - sku = _schema_disk_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_disk_read.tags - tags.Element = AAZStrType() - - zones = _schema_disk_read.zones - zones.Element = AAZStrType() - - _schema.extended_location = cls._schema_disk_read.extended_location - _schema.id = cls._schema_disk_read.id - _schema.location = cls._schema_disk_read.location - _schema.managed_by = cls._schema_disk_read.managed_by - _schema.managed_by_extended = cls._schema_disk_read.managed_by_extended - _schema.name = cls._schema_disk_read.name - _schema.properties = cls._schema_disk_read.properties - _schema.sku = cls._schema_disk_read.sku - _schema.tags = cls._schema_disk_read.tags - _schema.type = cls._schema_disk_read.type - _schema.zones = cls._schema_disk_read.zones - - _schema_image_disk_reference_read = None - - @classmethod - def _build_schema_image_disk_reference_read(cls, _schema): - if cls._schema_image_disk_reference_read is not None: - _schema.community_gallery_image_id = cls._schema_image_disk_reference_read.community_gallery_image_id - _schema.id = cls._schema_image_disk_reference_read.id - _schema.lun = cls._schema_image_disk_reference_read.lun - _schema.shared_gallery_image_id = cls._schema_image_disk_reference_read.shared_gallery_image_id - return - - cls._schema_image_disk_reference_read = _schema_image_disk_reference_read = AAZObjectType() - - image_disk_reference_read = _schema_image_disk_reference_read - image_disk_reference_read.community_gallery_image_id = AAZStrType( - serialized_name="communityGalleryImageId", - ) - image_disk_reference_read.id = AAZStrType() - image_disk_reference_read.lun = AAZIntType() - image_disk_reference_read.shared_gallery_image_id = AAZStrType( - serialized_name="sharedGalleryImageId", - ) - - _schema.community_gallery_image_id = cls._schema_image_disk_reference_read.community_gallery_image_id - _schema.id = cls._schema_image_disk_reference_read.id - _schema.lun = cls._schema_image_disk_reference_read.lun - _schema.shared_gallery_image_id = cls._schema_image_disk_reference_read.shared_gallery_image_id - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_wait.py deleted file mode 100644 index aac13d3e855..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk/_wait.py +++ /dev/null @@ -1,333 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/disks/{}", "2019-07-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_name = AAZStrArg( - options=["-n", "--name", "--disk-name"], - help="The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DisksGet(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=False) - return result - - class DisksGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskName", self.ctx.args.disk_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.zones = AAZListType() - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - properties.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.disk_state = AAZStrType( - serialized_name="diskState", - flags={"read_only": True}, - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption = cls._schema_on_200.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = cls._schema_on_200.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/__cmd_group.py deleted file mode 100644 index 5da3a6f6d8e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-access", -) -class __CMDGroup(AAZCommandGroup): - """Manage disk access resources. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_create.py deleted file mode 100644 index a495ec963bf..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_create.py +++ /dev/null @@ -1,317 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-access create", -) -class Create(AAZCommand): - """Create a disk access resource - - :example: Create a disk access resource. - az disk-access create -g MyResourceGroup -l centraluseuap -n MyDiskAccess - """ - - _aaz_info = { - "version": "2020-05-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskaccesses/{}", "2020-05-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_access_name = AAZStrArg( - options=["-n", "--name", "--disk-access-name"], - help="The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "DiskAccess" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="DiskAccess", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="DiskAccess", - help="Resource tags", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DiskAccessesCreateOrUpdate(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 DiskAccessesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskAccessName", self.ctx.args.disk_access_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-05-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - 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() - _CreateHelper._build_schema_disk_access_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _CreateHelper: - """Helper class for Create""" - - _schema_disk_access_read = None - - @classmethod - def _build_schema_disk_access_read(cls, _schema): - if cls._schema_disk_access_read is not None: - _schema.id = cls._schema_disk_access_read.id - _schema.location = cls._schema_disk_access_read.location - _schema.name = cls._schema_disk_access_read.name - _schema.properties = cls._schema_disk_access_read.properties - _schema.tags = cls._schema_disk_access_read.tags - _schema.type = cls._schema_disk_access_read.type - return - - cls._schema_disk_access_read = _schema_disk_access_read = AAZObjectType() - - disk_access_read = _schema_disk_access_read - disk_access_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_access_read.location = AAZStrType( - flags={"required": True}, - ) - disk_access_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_access_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_access_read.tags = AAZDictType() - disk_access_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_disk_access_read.properties - properties.private_endpoint_connections = AAZListType( - serialized_name="privateEndpointConnections", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - private_endpoint_connections = _schema_disk_access_read.properties.private_endpoint_connections - private_endpoint_connections.Element = AAZObjectType() - - _element = _schema_disk_access_read.properties.private_endpoint_connections.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_disk_access_read.properties.private_endpoint_connections.Element.properties - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - private_endpoint = _schema_disk_access_read.properties.private_endpoint_connections.Element.properties.private_endpoint - private_endpoint.id = AAZStrType( - flags={"read_only": True}, - ) - - private_link_service_connection_state = _schema_disk_access_read.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - tags = _schema_disk_access_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_disk_access_read.id - _schema.location = cls._schema_disk_access_read.location - _schema.name = cls._schema_disk_access_read.name - _schema.properties = cls._schema_disk_access_read.properties - _schema.tags = cls._schema_disk_access_read.tags - _schema.type = cls._schema_disk_access_read.type - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_delete.py deleted file mode 100644 index 35ab6c9c63c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_delete.py +++ /dev/null @@ -1,162 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-access delete", -) -class Delete(AAZCommand): - """Delete a disk access resource. - - :example: Delete a disk access resource. - az disk-access delete -g MyResourceGroup -n MyDiskAccess - """ - - _aaz_info = { - "version": "2020-05-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskaccesses/{}", "2020-05-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.disk_access_name = AAZStrArg( - options=["-n", "--name", "--disk-access-name"], - help="The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DiskAccessesDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class DiskAccessesDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskAccessName", self.ctx.args.disk_access_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-05-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_list.py deleted file mode 100644 index 2dfad9e4bf8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_list.py +++ /dev/null @@ -1,408 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-access list", -) -class List(AAZCommand): - """List all the disk access resources under a resource group. - - :example: List all disk access resources in a resource group. - az disk-access list -g MyResourceGroup - """ - - _aaz_info = { - "version": "2020-05-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/diskaccesses", "2020-05-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskaccesses", "2020-05-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.DiskAccessesList(ctx=self.ctx)() - if condition_1: - self.DiskAccessesListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class DiskAccessesList(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.Compute/diskAccesses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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", "2020-05-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.private_endpoint_connections = AAZListType( - serialized_name="privateEndpointConnections", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - private_endpoint_connections = cls._schema_on_200.value.Element.properties.private_endpoint_connections - private_endpoint_connections.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - private_endpoint = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_endpoint - private_endpoint.id = AAZStrType( - flags={"read_only": True}, - ) - - private_link_service_connection_state = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class DiskAccessesListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-05-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.private_endpoint_connections = AAZListType( - serialized_name="privateEndpointConnections", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - private_endpoint_connections = cls._schema_on_200.value.Element.properties.private_endpoint_connections - private_endpoint_connections.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - private_endpoint = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_endpoint - private_endpoint.id = AAZStrType( - flags={"read_only": True}, - ) - - private_link_service_connection_state = cls._schema_on_200.value.Element.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_show.py deleted file mode 100644 index 553b33d69dd..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_show.py +++ /dev/null @@ -1,239 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-access show", -) -class Show(AAZCommand): - """Get information about a disk access resource. - - :example: Get information of a disk access resource. - az disk-access show -g MyResourceGroup -n MyDiskAccess - """ - - _aaz_info = { - "version": "2020-05-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskaccesses/{}", "2020-05-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_access_name = AAZStrArg( - options=["-n", "--name", "--disk-access-name"], - help="The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DiskAccessesGet(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 DiskAccessesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskAccessName", self.ctx.args.disk_access_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-05-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.private_endpoint_connections = AAZListType( - serialized_name="privateEndpointConnections", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections - private_endpoint_connections.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.private_endpoint_connections.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint - private_endpoint.id = AAZStrType( - flags={"read_only": True}, - ) - - private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_update.py deleted file mode 100644 index 7eda088037a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_update.py +++ /dev/null @@ -1,439 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-access update", -) -class Update(AAZCommand): - """Update a disk access resource - - :example: Update a disk access resource. - az disk-access update -g MyResourceGroup -n MyDiskAccess --tags tag1=val1 tag2=val2 - """ - - _aaz_info = { - "version": "2020-05-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskaccesses/{}", "2020-05-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_access_name = AAZStrArg( - options=["-n", "--name", "--disk-access-name"], - help="The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "DiskAccess" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="DiskAccess", - help="Resource location", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="DiskAccess", - help="Resource tags", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DiskAccessesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.DiskAccessesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class DiskAccessesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskAccessName", self.ctx.args.disk_access_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-05-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_disk_access_read(cls._schema_on_200) - - return cls._schema_on_200 - - class DiskAccessesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskAccessName", self.ctx.args.disk_access_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-05-01", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_disk_access_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - _schema_disk_access_read = None - - @classmethod - def _build_schema_disk_access_read(cls, _schema): - if cls._schema_disk_access_read is not None: - _schema.id = cls._schema_disk_access_read.id - _schema.location = cls._schema_disk_access_read.location - _schema.name = cls._schema_disk_access_read.name - _schema.properties = cls._schema_disk_access_read.properties - _schema.tags = cls._schema_disk_access_read.tags - _schema.type = cls._schema_disk_access_read.type - return - - cls._schema_disk_access_read = _schema_disk_access_read = AAZObjectType() - - disk_access_read = _schema_disk_access_read - disk_access_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_access_read.location = AAZStrType( - flags={"required": True}, - ) - disk_access_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_access_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_access_read.tags = AAZDictType() - disk_access_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_disk_access_read.properties - properties.private_endpoint_connections = AAZListType( - serialized_name="privateEndpointConnections", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - private_endpoint_connections = _schema_disk_access_read.properties.private_endpoint_connections - private_endpoint_connections.Element = AAZObjectType() - - _element = _schema_disk_access_read.properties.private_endpoint_connections.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_disk_access_read.properties.private_endpoint_connections.Element.properties - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - private_endpoint = _schema_disk_access_read.properties.private_endpoint_connections.Element.properties.private_endpoint - private_endpoint.id = AAZStrType( - flags={"read_only": True}, - ) - - private_link_service_connection_state = _schema_disk_access_read.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - tags = _schema_disk_access_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_disk_access_read.id - _schema.location = cls._schema_disk_access_read.location - _schema.name = cls._schema_disk_access_read.name - _schema.properties = cls._schema_disk_access_read.properties - _schema.tags = cls._schema_disk_access_read.tags - _schema.type = cls._schema_disk_access_read.type - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_wait.py deleted file mode 100644 index df25ff67bd7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_access/_wait.py +++ /dev/null @@ -1,235 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-access wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskaccesses/{}", "2020-05-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_access_name = AAZStrArg( - options=["-n", "--name", "--disk-access-name"], - help="The name of the disk access resource that is being created. The name can't be changed after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DiskAccessesGet(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=False) - return result - - class DiskAccessesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskAccessName", self.ctx.args.disk_access_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-05-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.private_endpoint_connections = AAZListType( - serialized_name="privateEndpointConnections", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - - private_endpoint_connections = cls._schema_on_200.properties.private_endpoint_connections - private_endpoint_connections.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.private_endpoint_connections.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties.private_endpoint_connections.Element.properties - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - private_endpoint = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_endpoint - private_endpoint.id = AAZStrType( - flags={"read_only": True}, - ) - - private_link_service_connection_state = cls._schema_on_200.properties.private_endpoint_connections.Element.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/__cmd_group.py deleted file mode 100644 index 678c2a6612c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-encryption-set", -) -class __CMDGroup(AAZCommandGroup): - """Disk Encryption Set resource. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_create.py deleted file mode 100644 index 9a61e6feb53..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_create.py +++ /dev/null @@ -1,495 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-encryption-set create", -) -class Create(AAZCommand): - """Create a disk encryption set - - :example: Create a disk encryption set - az disk-encryption-set create --resource-group MyResourceGroup --name MyDiskEncryptionSet --key-url MyKey --source-vault MyVault - - :example: Create a disk encryption set with a system assigned identity. - az disk-encryption-set create --resource-group MyResourceGroup --name MyDiskEncryptionSet --key-url MyKey --source-vault MyVault --mi-system-assigned - - :example: Create a disk encryption set with a user assigned identity. - az disk-encryption-set create --resource-group MyResourceGroup --name MyDiskEncryptionSet --key-url MyKey --source-vault MyVault --mi-user-assigned myAssignedId - - :example: Create a disk encryption set with system assigned identity and a user assigned identity. - az disk-encryption-set create --resource-group MyResourceGroup --name MyDiskEncryptionSet --key-url MyKey --source-vault MyVault --mi-system-assigned --mi-user-assigned myAssignedId - - :example: Create a disk encryption set with multi-tenant application client id to access key vault in a different tenant. - az disk-encryption-set create --resource-group MyResourceGroup --name MyDiskEncryptionSet --key-url MyKey --source-vault MyVault --federated-client-id myFederatedClientId - - :example: Create a disk encryption set. - az disk-encryption-set create --resource-group MyResourceGroup --name MyDiskEncryptionSet --key-url MyKey --source-vault MyVault --encryption-type EncryptionAtRestWithPlatformAndCustomerKeys - """ - - _aaz_info = { - "version": "2023-04-02", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskencryptionsets/{}", "2023-04-02"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_name = AAZStrArg( - options=["-n", "--name", "--disk-encryption-set-name"], - help="Name of disk encryption set.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.location = AAZResourceLocationArg( - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.key_url = AAZStrArg( - options=["--key-url"], - help="URL pointing to a key or secret in KeyVault.", - ) - _args_schema.source_vault = AAZStrArg( - options=["--source-vault"], - help="Name or ID of the KeyVault containing the key or secret.", - ) - _args_schema.encryption_type = AAZStrArg( - options=["--encryption-type"], - help="The type of key used to encrypt the data of the disk. EncryptionAtRestWithCustomerKey: Disk is encrypted at rest with Customer managed key that can be changed and revoked by a customer. EncryptionAtRestWithPlatformAndCustomerKeys: Disk is encrypted at rest with 2 layers of encryption. One of the keys is Customer managed and the other key is Platform managed. ConfidentialVmEncryptedWithCustomerKey: An additional encryption type accepted for confidential VM. Disk is encrypted at rest with Customer managed key.", - enum={"ConfidentialVmEncryptedWithCustomerKey": "ConfidentialVmEncryptedWithCustomerKey", "EncryptionAtRestWithCustomerKey": "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformAndCustomerKeys": "EncryptionAtRestWithPlatformAndCustomerKeys"}, - ) - _args_schema.federated_client_id = AAZStrArg( - options=["--federated-client-id"], - help="The federated client id used in cross tenant scenario.", - ) - _args_schema.enable_auto_key_rotation = AAZBoolArg( - options=["--auto-rotation", "--enable-auto-key-rotation"], - help="Enable automatic rotation of keys.", - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - help="Resource tags", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Managed Identity" - - _args_schema = cls._args_schema - _args_schema.identity = AAZObjectArg( - options=["--identity"], - arg_group="Managed Identity", - help="The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks.", - ) - - identity = cls._args_schema.identity - identity.mi_system_assigned = AAZStrArg( - options=["system-assigned", "mi-system-assigned"], - help="Set the system managed identity.", - blank="True", - ) - identity.type = AAZStrArg( - options=["type"], - help="The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys.", - enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned, UserAssigned": "SystemAssigned, UserAssigned", "UserAssigned": "UserAssigned"}, - ) - identity.mi_user_assigned = AAZListArg( - options=["user-assigned", "mi-user-assigned"], - help="Set the user managed identities.", - blank=[], - ) - identity.user_assigned_identities = AAZDictArg( - options=["user-assigned-identities"], - help="The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.", - ) - - mi_user_assigned = cls._args_schema.identity.mi_user_assigned - mi_user_assigned.Element = AAZStrArg() - - user_assigned_identities = cls._args_schema.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectArg( - blank={}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DiskEncryptionSetsCreateOrUpdate(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 DiskEncryptionSetsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskEncryptionSetName", self.ctx.args.disk_encryption_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - 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("identity", AAZIdentityObjectType, ".identity") - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - identity = _builder.get(".identity") - if identity is not None: - identity.set_prop("type", AAZStrType, ".type") - identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") - identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}}) - identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}}) - - user_assigned_identities = _builder.get(".identity.userAssignedIdentities") - if user_assigned_identities is not None: - user_assigned_identities.set_elements(AAZObjectType, ".") - - user_assigned = _builder.get(".identity.userAssigned") - if user_assigned is not None: - user_assigned.set_elements(AAZStrType, ".") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("activeKey", AAZObjectType) - properties.set_prop("encryptionType", AAZStrType, ".encryption_type") - properties.set_prop("federatedClientId", AAZStrType, ".federated_client_id") - properties.set_prop("rotationToLatestKeyVersionEnabled", AAZBoolType, ".enable_auto_key_rotation") - - active_key = _builder.get(".properties.activeKey") - if active_key is not None: - active_key.set_prop("keyUrl", AAZStrType, ".key_url", typ_kwargs={"flags": {"required": True}}) - active_key.set_prop("sourceVault", AAZObjectType) - - source_vault = _builder.get(".properties.activeKey.sourceVault") - if source_vault is not None: - source_vault.set_prop("id", AAZStrType, ".source_vault") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - 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() - _CreateHelper._build_schema_disk_encryption_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _CreateHelper: - """Helper class for Create""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType( - flags={"read_only": True} - ) - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - _schema_disk_encryption_set_read = None - - @classmethod - def _build_schema_disk_encryption_set_read(cls, _schema): - if cls._schema_disk_encryption_set_read is not None: - _schema.id = cls._schema_disk_encryption_set_read.id - _schema.identity = cls._schema_disk_encryption_set_read.identity - _schema.location = cls._schema_disk_encryption_set_read.location - _schema.name = cls._schema_disk_encryption_set_read.name - _schema.properties = cls._schema_disk_encryption_set_read.properties - _schema.tags = cls._schema_disk_encryption_set_read.tags - _schema.type = cls._schema_disk_encryption_set_read.type - return - - cls._schema_disk_encryption_set_read = _schema_disk_encryption_set_read = AAZObjectType() - - disk_encryption_set_read = _schema_disk_encryption_set_read - disk_encryption_set_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_encryption_set_read.identity = AAZIdentityObjectType() - disk_encryption_set_read.location = AAZStrType( - flags={"required": True}, - ) - disk_encryption_set_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_encryption_set_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_encryption_set_read.tags = AAZDictType() - disk_encryption_set_read.type = AAZStrType( - flags={"read_only": True}, - ) - - identity = _schema_disk_encryption_set_read.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = _schema_disk_encryption_set_read.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = _schema_disk_encryption_set_read.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - properties = _schema_disk_encryption_set_read.properties - properties.active_key = AAZObjectType( - serialized_name="activeKey", - ) - cls._build_schema_key_for_disk_encryption_set_read(properties.active_key) - properties.auto_key_rotation_error = AAZObjectType( - serialized_name="autoKeyRotationError", - flags={"read_only": True}, - ) - cls._build_schema_api_error_read(properties.auto_key_rotation_error) - properties.encryption_type = AAZStrType( - serialized_name="encryptionType", - ) - properties.federated_client_id = AAZStrType( - serialized_name="federatedClientId", - ) - properties.last_key_rotation_timestamp = AAZStrType( - serialized_name="lastKeyRotationTimestamp", - flags={"read_only": True}, - ) - properties.previous_keys = AAZListType( - serialized_name="previousKeys", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.rotation_to_latest_key_version_enabled = AAZBoolType( - serialized_name="rotationToLatestKeyVersionEnabled", - ) - - previous_keys = _schema_disk_encryption_set_read.properties.previous_keys - previous_keys.Element = AAZObjectType() - cls._build_schema_key_for_disk_encryption_set_read(previous_keys.Element) - - tags = _schema_disk_encryption_set_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_disk_encryption_set_read.id - _schema.identity = cls._schema_disk_encryption_set_read.identity - _schema.location = cls._schema_disk_encryption_set_read.location - _schema.name = cls._schema_disk_encryption_set_read.name - _schema.properties = cls._schema_disk_encryption_set_read.properties - _schema.tags = cls._schema_disk_encryption_set_read.tags - _schema.type = cls._schema_disk_encryption_set_read.type - - _schema_key_for_disk_encryption_set_read = None - - @classmethod - def _build_schema_key_for_disk_encryption_set_read(cls, _schema): - if cls._schema_key_for_disk_encryption_set_read is not None: - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - return - - cls._schema_key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read = AAZObjectType() - - key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read - key_for_disk_encryption_set_read.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_for_disk_encryption_set_read.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - - source_vault = _schema_key_for_disk_encryption_set_read.source_vault - source_vault.id = AAZStrType() - - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_delete.py deleted file mode 100644 index b978399cf6f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_delete.py +++ /dev/null @@ -1,162 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-encryption-set delete", -) -class Delete(AAZCommand): - """Delete a disk encryption set. - - :example: Delete a disk encryption set. - az disk-encryption-set delete --name MyDiskEncryptionSet --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2023-04-02", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskencryptionsets/{}", "2023-04-02"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_name = AAZStrArg( - options=["-n", "--name", "--disk-encryption-set-name"], - help="Name of disk encryption set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DiskEncryptionSetsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class DiskEncryptionSetsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskEncryptionSetName", self.ctx.args.disk_encryption_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_list.py deleted file mode 100644 index eb31b33c9e0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_list.py +++ /dev/null @@ -1,494 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-encryption-set list", -) -class List(AAZCommand): - """List disk encryption sets. - - :example: List all disk encryption sets in a subscription. - az disk-encryption-set list - - :example: List all disk encryption sets in a resource group. - az disk-encryption-set list --resource-group myResourceGroup - """ - - _aaz_info = { - "version": "2023-04-02", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/diskencryptionsets", "2023-04-02"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskencryptionsets", "2023-04-02"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.DiskEncryptionSetsList(ctx=self.ctx)() - if condition_1: - self.DiskEncryptionSetsListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class DiskEncryptionSetsList(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.Compute/diskEncryptionSets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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-02", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.identity = AAZIdentityObjectType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - identity = cls._schema_on_200.value.Element.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.active_key = AAZObjectType( - serialized_name="activeKey", - ) - _ListHelper._build_schema_key_for_disk_encryption_set_read(properties.active_key) - properties.auto_key_rotation_error = AAZObjectType( - serialized_name="autoKeyRotationError", - flags={"read_only": True}, - ) - _ListHelper._build_schema_api_error_read(properties.auto_key_rotation_error) - properties.encryption_type = AAZStrType( - serialized_name="encryptionType", - ) - properties.federated_client_id = AAZStrType( - serialized_name="federatedClientId", - ) - properties.last_key_rotation_timestamp = AAZStrType( - serialized_name="lastKeyRotationTimestamp", - flags={"read_only": True}, - ) - properties.previous_keys = AAZListType( - serialized_name="previousKeys", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.rotation_to_latest_key_version_enabled = AAZBoolType( - serialized_name="rotationToLatestKeyVersionEnabled", - ) - - previous_keys = cls._schema_on_200.value.Element.properties.previous_keys - previous_keys.Element = AAZObjectType() - _ListHelper._build_schema_key_for_disk_encryption_set_read(previous_keys.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class DiskEncryptionSetsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.identity = AAZIdentityObjectType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - identity = cls._schema_on_200.value.Element.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.active_key = AAZObjectType( - serialized_name="activeKey", - ) - _ListHelper._build_schema_key_for_disk_encryption_set_read(properties.active_key) - properties.auto_key_rotation_error = AAZObjectType( - serialized_name="autoKeyRotationError", - flags={"read_only": True}, - ) - _ListHelper._build_schema_api_error_read(properties.auto_key_rotation_error) - properties.encryption_type = AAZStrType( - serialized_name="encryptionType", - ) - properties.federated_client_id = AAZStrType( - serialized_name="federatedClientId", - ) - properties.last_key_rotation_timestamp = AAZStrType( - serialized_name="lastKeyRotationTimestamp", - flags={"read_only": True}, - ) - properties.previous_keys = AAZListType( - serialized_name="previousKeys", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.rotation_to_latest_key_version_enabled = AAZBoolType( - serialized_name="rotationToLatestKeyVersionEnabled", - ) - - previous_keys = cls._schema_on_200.value.Element.properties.previous_keys - previous_keys.Element = AAZObjectType() - _ListHelper._build_schema_key_for_disk_encryption_set_read(previous_keys.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType( - flags={"read_only": True} - ) - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - _schema_key_for_disk_encryption_set_read = None - - @classmethod - def _build_schema_key_for_disk_encryption_set_read(cls, _schema): - if cls._schema_key_for_disk_encryption_set_read is not None: - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - return - - cls._schema_key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read = AAZObjectType() - - key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read - key_for_disk_encryption_set_read.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_for_disk_encryption_set_read.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - - source_vault = _schema_key_for_disk_encryption_set_read.source_vault - source_vault.id = AAZStrType() - - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_show.py deleted file mode 100644 index 006b2422294..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_show.py +++ /dev/null @@ -1,314 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-encryption-set show", -) -class Show(AAZCommand): - """Get information about a disk encryption set. - - :example: Get information of a disk encryption sets - az disk-encryption-set show --name MyDiskEncryptionSet --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2023-04-02", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskencryptionsets/{}", "2023-04-02"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_name = AAZStrArg( - options=["-n", "--name", "--disk-encryption-set-name"], - help="Name of disk encryption set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DiskEncryptionSetsGet(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 DiskEncryptionSetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskEncryptionSetName", self.ctx.args.disk_encryption_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.identity = AAZIdentityObjectType() - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - identity = cls._schema_on_200.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = cls._schema_on_200.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.active_key = AAZObjectType( - serialized_name="activeKey", - ) - _ShowHelper._build_schema_key_for_disk_encryption_set_read(properties.active_key) - properties.auto_key_rotation_error = AAZObjectType( - serialized_name="autoKeyRotationError", - flags={"read_only": True}, - ) - _ShowHelper._build_schema_api_error_read(properties.auto_key_rotation_error) - properties.encryption_type = AAZStrType( - serialized_name="encryptionType", - ) - properties.federated_client_id = AAZStrType( - serialized_name="federatedClientId", - ) - properties.last_key_rotation_timestamp = AAZStrType( - serialized_name="lastKeyRotationTimestamp", - flags={"read_only": True}, - ) - properties.previous_keys = AAZListType( - serialized_name="previousKeys", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.rotation_to_latest_key_version_enabled = AAZBoolType( - serialized_name="rotationToLatestKeyVersionEnabled", - ) - - previous_keys = cls._schema_on_200.properties.previous_keys - previous_keys.Element = AAZObjectType() - _ShowHelper._build_schema_key_for_disk_encryption_set_read(previous_keys.Element) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType( - flags={"read_only": True} - ) - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - _schema_key_for_disk_encryption_set_read = None - - @classmethod - def _build_schema_key_for_disk_encryption_set_read(cls, _schema): - if cls._schema_key_for_disk_encryption_set_read is not None: - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - return - - cls._schema_key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read = AAZObjectType() - - key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read - key_for_disk_encryption_set_read.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_for_disk_encryption_set_read.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - - source_vault = _schema_key_for_disk_encryption_set_read.source_vault - source_vault.id = AAZStrType() - - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_update.py deleted file mode 100644 index b83a83cd8eb..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_update.py +++ /dev/null @@ -1,568 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-encryption-set update", -) -class Update(AAZCommand): - """Update a disk encryption set - - :example: Update a disk encryption set. - az disk-encryption-set update --name MyDiskEncryptionSet --resource-group MyResourceGroup --key-url MyKey --source-vault MyVault - - :example: Update multi-tenant application client id of a disk encryption set. - az disk-encryption-set update --name MyDiskEncryptionSet --resource-group MyResourceGroup --key-url MyKey --source-vault MyVault --federated-client-id myFederatedClientId - - :example: Clear multi-tenant application client id of a disk encryption set. - az disk-encryption-set update --name MyDiskEncryptionSet --resource-group MyResourceGroup --key-url MyKey --source-vault MyVault --federated-client-id None - """ - - _aaz_info = { - "version": "2023-04-02", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskencryptionsets/{}", "2023-04-02"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_name = AAZStrArg( - options=["-n", "--name", "--disk-encryption-set-name"], - help="Name of disk encryption set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.key_url = AAZStrArg( - options=["--key-url"], - help="URL pointing to a key or secret in KeyVault.", - ) - _args_schema.source_vault = AAZStrArg( - options=["--source-vault"], - help="Name or ID of the KeyVault containing the key or secret.", - nullable=True, - ) - _args_schema.federated_client_id = AAZStrArg( - options=["--federated-client-id"], - help="The federated client id used in cross tenant scenario.", - nullable=True, - ) - _args_schema.enable_auto_key_rotation = AAZBoolArg( - options=["--auto-rotation", "--enable-auto-key-rotation"], - help="Enable automatic rotation of keys.", - nullable=True, - ) - - # define Arg Group "DiskEncryptionSet" - - _args_schema = cls._args_schema - _args_schema.identity = AAZObjectArg( - options=["--identity"], - arg_group="DiskEncryptionSet", - help="The managed identity for the disk encryption set. It should be given permission on the key vault before it can be used to encrypt disks.", - nullable=True, - ) - - identity = cls._args_schema.identity - identity.type = AAZStrArg( - options=["type"], - help="The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys.", - nullable=True, - enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned, UserAssigned": "SystemAssigned, UserAssigned", "UserAssigned": "UserAssigned"}, - ) - identity.user_assigned_identities = AAZDictArg( - options=["user-assigned-identities"], - help="The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.", - nullable=True, - ) - - user_assigned_identities = cls._args_schema.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectArg( - nullable=True, - blank={}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DiskEncryptionSetsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.DiskEncryptionSetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class DiskEncryptionSetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskEncryptionSetName", self.ctx.args.disk_encryption_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_disk_encryption_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - class DiskEncryptionSetsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskEncryptionSetName", self.ctx.args.disk_encryption_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_disk_encryption_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("identity", AAZIdentityObjectType, ".identity") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - identity = _builder.get(".identity") - if identity is not None: - identity.set_prop("type", AAZStrType, ".type") - identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities") - - user_assigned_identities = _builder.get(".identity.userAssignedIdentities") - if user_assigned_identities is not None: - user_assigned_identities.set_elements(AAZObjectType, ".") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("activeKey", AAZObjectType) - properties.set_prop("federatedClientId", AAZStrType, ".federated_client_id") - properties.set_prop("rotationToLatestKeyVersionEnabled", AAZBoolType, ".enable_auto_key_rotation") - - active_key = _builder.get(".properties.activeKey") - if active_key is not None: - active_key.set_prop("keyUrl", AAZStrType, ".key_url", typ_kwargs={"flags": {"required": True}}) - active_key.set_prop("sourceVault", AAZObjectType) - - source_vault = _builder.get(".properties.activeKey.sourceVault") - if source_vault is not None: - source_vault.set_prop("id", AAZStrType, ".source_vault") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType( - flags={"read_only": True} - ) - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - _schema_disk_encryption_set_read = None - - @classmethod - def _build_schema_disk_encryption_set_read(cls, _schema): - if cls._schema_disk_encryption_set_read is not None: - _schema.id = cls._schema_disk_encryption_set_read.id - _schema.identity = cls._schema_disk_encryption_set_read.identity - _schema.location = cls._schema_disk_encryption_set_read.location - _schema.name = cls._schema_disk_encryption_set_read.name - _schema.properties = cls._schema_disk_encryption_set_read.properties - _schema.tags = cls._schema_disk_encryption_set_read.tags - _schema.type = cls._schema_disk_encryption_set_read.type - return - - cls._schema_disk_encryption_set_read = _schema_disk_encryption_set_read = AAZObjectType() - - disk_encryption_set_read = _schema_disk_encryption_set_read - disk_encryption_set_read.id = AAZStrType( - flags={"read_only": True}, - ) - disk_encryption_set_read.identity = AAZIdentityObjectType() - disk_encryption_set_read.location = AAZStrType( - flags={"required": True}, - ) - disk_encryption_set_read.name = AAZStrType( - flags={"read_only": True}, - ) - disk_encryption_set_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - disk_encryption_set_read.tags = AAZDictType() - disk_encryption_set_read.type = AAZStrType( - flags={"read_only": True}, - ) - - identity = _schema_disk_encryption_set_read.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = _schema_disk_encryption_set_read.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = _schema_disk_encryption_set_read.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - properties = _schema_disk_encryption_set_read.properties - properties.active_key = AAZObjectType( - serialized_name="activeKey", - ) - cls._build_schema_key_for_disk_encryption_set_read(properties.active_key) - properties.auto_key_rotation_error = AAZObjectType( - serialized_name="autoKeyRotationError", - flags={"read_only": True}, - ) - cls._build_schema_api_error_read(properties.auto_key_rotation_error) - properties.encryption_type = AAZStrType( - serialized_name="encryptionType", - ) - properties.federated_client_id = AAZStrType( - serialized_name="federatedClientId", - ) - properties.last_key_rotation_timestamp = AAZStrType( - serialized_name="lastKeyRotationTimestamp", - flags={"read_only": True}, - ) - properties.previous_keys = AAZListType( - serialized_name="previousKeys", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.rotation_to_latest_key_version_enabled = AAZBoolType( - serialized_name="rotationToLatestKeyVersionEnabled", - ) - - previous_keys = _schema_disk_encryption_set_read.properties.previous_keys - previous_keys.Element = AAZObjectType() - cls._build_schema_key_for_disk_encryption_set_read(previous_keys.Element) - - tags = _schema_disk_encryption_set_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_disk_encryption_set_read.id - _schema.identity = cls._schema_disk_encryption_set_read.identity - _schema.location = cls._schema_disk_encryption_set_read.location - _schema.name = cls._schema_disk_encryption_set_read.name - _schema.properties = cls._schema_disk_encryption_set_read.properties - _schema.tags = cls._schema_disk_encryption_set_read.tags - _schema.type = cls._schema_disk_encryption_set_read.type - - _schema_key_for_disk_encryption_set_read = None - - @classmethod - def _build_schema_key_for_disk_encryption_set_read(cls, _schema): - if cls._schema_key_for_disk_encryption_set_read is not None: - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - return - - cls._schema_key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read = AAZObjectType() - - key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read - key_for_disk_encryption_set_read.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_for_disk_encryption_set_read.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - - source_vault = _schema_key_for_disk_encryption_set_read.source_vault - source_vault.id = AAZStrType() - - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_wait.py deleted file mode 100644 index 0edfcad103e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/disk_encryption_set/_wait.py +++ /dev/null @@ -1,310 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "disk-encryption-set wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/diskencryptionsets/{}", "2023-04-02"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_name = AAZStrArg( - options=["-n", "--name", "--disk-encryption-set-name"], - help="Name of disk encryption set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DiskEncryptionSetsGet(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=False) - return result - - class DiskEncryptionSetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "diskEncryptionSetName", self.ctx.args.disk_encryption_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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-02", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.identity = AAZIdentityObjectType() - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - identity = cls._schema_on_200.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = cls._schema_on_200.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.active_key = AAZObjectType( - serialized_name="activeKey", - ) - _WaitHelper._build_schema_key_for_disk_encryption_set_read(properties.active_key) - properties.auto_key_rotation_error = AAZObjectType( - serialized_name="autoKeyRotationError", - flags={"read_only": True}, - ) - _WaitHelper._build_schema_api_error_read(properties.auto_key_rotation_error) - properties.encryption_type = AAZStrType( - serialized_name="encryptionType", - ) - properties.federated_client_id = AAZStrType( - serialized_name="federatedClientId", - ) - properties.last_key_rotation_timestamp = AAZStrType( - serialized_name="lastKeyRotationTimestamp", - flags={"read_only": True}, - ) - properties.previous_keys = AAZListType( - serialized_name="previousKeys", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.rotation_to_latest_key_version_enabled = AAZBoolType( - serialized_name="rotationToLatestKeyVersionEnabled", - ) - - previous_keys = cls._schema_on_200.properties.previous_keys - previous_keys.Element = AAZObjectType() - _WaitHelper._build_schema_key_for_disk_encryption_set_read(previous_keys.Element) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType( - flags={"read_only": True} - ) - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - _schema_key_for_disk_encryption_set_read = None - - @classmethod - def _build_schema_key_for_disk_encryption_set_read(cls, _schema): - if cls._schema_key_for_disk_encryption_set_read is not None: - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - return - - cls._schema_key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read = AAZObjectType() - - key_for_disk_encryption_set_read = _schema_key_for_disk_encryption_set_read - key_for_disk_encryption_set_read.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_for_disk_encryption_set_read.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - - source_vault = _schema_key_for_disk_encryption_set_read.source_vault - source_vault.id = AAZStrType() - - _schema.key_url = cls._schema_key_for_disk_encryption_set_read.key_url - _schema.source_vault = cls._schema_key_for_disk_encryption_set_read.source_vault - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/__cmd_group.py deleted file mode 100644 index 3e4a7f17f85..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image", -) -class __CMDGroup(AAZCommandGroup): - """Manage custom virtual machine images. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_create.py deleted file mode 100644 index 8aeb0dd1d98..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_create.py +++ /dev/null @@ -1,606 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image create", -) -class Create(AAZCommand): - """Create a custom Virtual Machine Image from managed disks or snapshots. - - :example: Create an image from an existing disk. - az image create -g MyResourceGroup -n image1 --os-type Linux --source /subscriptions/db5eb68e-73e2-4fa8-b18a-0123456789999/resourceGroups/rg1/providers/Microsoft.Compute/snapshots/s1 - - :example: Create an image by capturing an existing generalized virtual machine in the same resource group. - az image create -g MyResourceGroup -n image1 --source MyVm1 - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.hyper_v_generation = AAZStrArg( - options=["--hyper-v-generation"], - arg_group="Properties", - help="The hypervisor generation of the Virtual Machine created from the image.", - default="V1", - enum={"V1": "V1", "V2": "V2"}, - ) - _args_schema.source_virtual_machine = AAZObjectArg( - options=["--source-virtual-machine"], - arg_group="Properties", - help="The source virtual machine from which Image is created.", - ) - _args_schema.storage_profile = AAZObjectArg( - options=["--storage-profile"], - arg_group="Properties", - help="Specifies the storage settings for the virtual machine disks.", - ) - - source_virtual_machine = cls._args_schema.source_virtual_machine - source_virtual_machine.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - storage_profile = cls._args_schema.storage_profile - storage_profile.data_disks = AAZListArg( - options=["data-disks"], - help="Specifies the parameters that are used to add a data disk to a virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview).", - ) - storage_profile.os_disk = AAZObjectArg( - options=["os-disk"], - help="Specifies information about the operating system disk used by the virtual machine.

For more information about disks, see [About disks and VHDs for Azure virtual machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview).", - ) - storage_profile.zone_resilient = AAZBoolArg( - options=["zone-resilient"], - help="Specifies whether an image is zone resilient or not. Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS).", - ) - - data_disks = cls._args_schema.storage_profile.data_disks - data_disks.Element = AAZObjectArg() - - _element = cls._args_schema.storage_profile.data_disks.Element - _element.blob_uri = AAZStrArg( - options=["blob-uri"], - help="The Virtual Hard Disk.", - ) - _element.caching = AAZStrArg( - options=["caching"], - help="Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**", - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - _element.disk_encryption_set = AAZObjectArg( - options=["disk-encryption-set"], - help="Specifies the customer managed disk encryption set resource id for the managed image disk.", - ) - cls._build_args_disk_encryption_set_parameters_create(_element.disk_encryption_set) - _element.disk_size_gb = AAZIntArg( - options=["disk-size-gb"], - help="Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB", - ) - _element.lun = AAZIntArg( - options=["lun"], - help="Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.", - required=True, - ) - _element.managed_disk = AAZObjectArg( - options=["managed-disk"], - help="The managedDisk.", - ) - _element.snapshot = AAZObjectArg( - options=["snapshot"], - help="The snapshot.", - ) - _element.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.", - enum={"Premium_LRS": "Premium_LRS", "StandardSSD_LRS": "StandardSSD_LRS", "Standard_LRS": "Standard_LRS", "UltraSSD_LRS": "UltraSSD_LRS"}, - ) - - managed_disk = cls._args_schema.storage_profile.data_disks.Element.managed_disk - managed_disk.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - snapshot = cls._args_schema.storage_profile.data_disks.Element.snapshot - snapshot.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - os_disk = cls._args_schema.storage_profile.os_disk - os_disk.blob_uri = AAZStrArg( - options=["blob-uri"], - help="The Virtual Hard Disk.", - ) - os_disk.caching = AAZStrArg( - options=["caching"], - help="Specifies the caching requirements.

Possible values are:

**None**

**ReadOnly**

**ReadWrite**

Default: **None for Standard storage. ReadOnly for Premium storage**", - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - os_disk.disk_encryption_set = AAZObjectArg( - options=["disk-encryption-set"], - help="Specifies the customer managed disk encryption set resource id for the managed image disk.", - ) - cls._build_args_disk_encryption_set_parameters_create(os_disk.disk_encryption_set) - os_disk.disk_size_gb = AAZIntArg( - options=["disk-size-gb"], - help="Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image.

This value cannot be larger than 1023 GB", - ) - os_disk.managed_disk = AAZObjectArg( - options=["managed-disk"], - help="The managedDisk.", - ) - cls._build_args_sub_resource_create(os_disk.managed_disk) - os_disk.os_state = AAZStrArg( - options=["os-state"], - help="The OS State. For managed images, use Generalized.", - required=True, - enum={"Generalized": "Generalized", "Specialized": "Specialized"}, - ) - os_disk.os_type = AAZStrArg( - options=["os-type"], - help="This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image.

Possible values are:

**Windows**

**Linux**", - required=True, - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - os_disk.snapshot = AAZObjectArg( - options=["snapshot"], - help="The snapshot.", - ) - os_disk.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk.", - enum={"Premium_LRS": "Premium_LRS", "StandardSSD_LRS": "StandardSSD_LRS", "Standard_LRS": "Standard_LRS", "UltraSSD_LRS": "UltraSSD_LRS"}, - ) - - snapshot = cls._args_schema.storage_profile.os_disk.snapshot - snapshot.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - return cls._args_schema - - _args_disk_encryption_set_parameters_create = None - - @classmethod - def _build_args_disk_encryption_set_parameters_create(cls, _schema): - if cls._args_disk_encryption_set_parameters_create is not None: - _schema.id = cls._args_disk_encryption_set_parameters_create.id - return - - cls._args_disk_encryption_set_parameters_create = AAZObjectArg() - - disk_encryption_set_parameters_create = cls._args_disk_encryption_set_parameters_create - disk_encryption_set_parameters_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_disk_encryption_set_parameters_create.id - - _args_sub_resource_create = None - - @classmethod - def _build_args_sub_resource_create(cls, _schema): - if cls._args_sub_resource_create is not None: - _schema.id = cls._args_sub_resource_create.id - return - - cls._args_sub_resource_create = AAZObjectArg() - - sub_resource_create = cls._args_sub_resource_create - sub_resource_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_sub_resource_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.ImagesCreateOrUpdate(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 ImagesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("hyperVGeneration", AAZStrType, ".hyper_v_generation") - properties.set_prop("sourceVirtualMachine", AAZObjectType, ".source_virtual_machine") - properties.set_prop("storageProfile", AAZObjectType, ".storage_profile") - - source_virtual_machine = _builder.get(".properties.sourceVirtualMachine") - if source_virtual_machine is not None: - source_virtual_machine.set_prop("id", AAZStrType, ".id") - - storage_profile = _builder.get(".properties.storageProfile") - if storage_profile is not None: - storage_profile.set_prop("dataDisks", AAZListType, ".data_disks") - storage_profile.set_prop("osDisk", AAZObjectType, ".os_disk") - storage_profile.set_prop("zoneResilient", AAZBoolType, ".zone_resilient") - - data_disks = _builder.get(".properties.storageProfile.dataDisks") - if data_disks is not None: - data_disks.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.storageProfile.dataDisks[]") - if _elements is not None: - _elements.set_prop("blobUri", AAZStrType, ".blob_uri") - _elements.set_prop("caching", AAZStrType, ".caching") - _CreateHelper._build_schema_disk_encryption_set_parameters_create(_elements.set_prop("diskEncryptionSet", AAZObjectType, ".disk_encryption_set")) - _elements.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - _elements.set_prop("lun", AAZIntType, ".lun", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("managedDisk", AAZObjectType, ".managed_disk") - _elements.set_prop("snapshot", AAZObjectType, ".snapshot") - _elements.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - - managed_disk = _builder.get(".properties.storageProfile.dataDisks[].managedDisk") - if managed_disk is not None: - managed_disk.set_prop("id", AAZStrType, ".id") - - snapshot = _builder.get(".properties.storageProfile.dataDisks[].snapshot") - if snapshot is not None: - snapshot.set_prop("id", AAZStrType, ".id") - - os_disk = _builder.get(".properties.storageProfile.osDisk") - if os_disk is not None: - os_disk.set_prop("blobUri", AAZStrType, ".blob_uri") - os_disk.set_prop("caching", AAZStrType, ".caching") - _CreateHelper._build_schema_disk_encryption_set_parameters_create(os_disk.set_prop("diskEncryptionSet", AAZObjectType, ".disk_encryption_set")) - os_disk.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - _CreateHelper._build_schema_sub_resource_create(os_disk.set_prop("managedDisk", AAZObjectType, ".managed_disk")) - os_disk.set_prop("osState", AAZStrType, ".os_state", typ_kwargs={"flags": {"required": True}}) - os_disk.set_prop("osType", AAZStrType, ".os_type", typ_kwargs={"flags": {"required": True}}) - os_disk.set_prop("snapshot", AAZObjectType, ".snapshot") - os_disk.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - - snapshot = _builder.get(".properties.storageProfile.osDisk.snapshot") - if snapshot is not None: - snapshot.set_prop("id", AAZStrType, ".id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200_201.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _CreateHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200_201.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200_201.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _CreateHelper._build_schema_disk_encryption_set_parameters_read(_element.disk_encryption_set) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _CreateHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _CreateHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200_201.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _CreateHelper._build_schema_disk_encryption_set_parameters_read(os_disk.disk_encryption_set) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _CreateHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _CreateHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_disk_encryption_set_parameters_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - @classmethod - def _build_schema_sub_resource_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_disk_encryption_set_parameters_read = None - - @classmethod - def _build_schema_disk_encryption_set_parameters_read(cls, _schema): - if cls._schema_disk_encryption_set_parameters_read is not None: - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - return - - cls._schema_disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read = AAZObjectType() - - disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read - disk_encryption_set_parameters_read.id = AAZStrType() - - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_delete.py deleted file mode 100644 index 80612799f3e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_delete.py +++ /dev/null @@ -1,159 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image delete", -) -class Delete(AAZCommand): - """Delete an Image. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.ImagesDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class ImagesDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_list.py deleted file mode 100644 index 771559dc333..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_list.py +++ /dev/null @@ -1,493 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image list", -) -class List(AAZCommand): - """List the list of images under a resource group. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/images", "2020-06-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images", "2020-06-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.ImagesList(ctx=self.ctx)() - if condition_1: - self.ImagesListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class ImagesList(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.Compute/images", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ListHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _ListHelper._build_schema_disk_encryption_set_parameters_read(_element.disk_encryption_set) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _ListHelper._build_schema_disk_encryption_set_parameters_read(os_disk.disk_encryption_set) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class ImagesListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ListHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _ListHelper._build_schema_disk_encryption_set_parameters_read(_element.disk_encryption_set) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _ListHelper._build_schema_disk_encryption_set_parameters_read(os_disk.disk_encryption_set) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_disk_encryption_set_parameters_read = None - - @classmethod - def _build_schema_disk_encryption_set_parameters_read(cls, _schema): - if cls._schema_disk_encryption_set_parameters_read is not None: - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - return - - cls._schema_disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read = AAZObjectType() - - disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read - disk_encryption_set_parameters_read.id = AAZStrType() - - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_show.py deleted file mode 100644 index b1dfbaf9012..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_show.py +++ /dev/null @@ -1,302 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image show", -) -class Show(AAZCommand): - """Get an image. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(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 ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _ShowHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _ShowHelper._build_schema_disk_encryption_set_parameters_read(_element.disk_encryption_set) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ShowHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _ShowHelper._build_schema_disk_encryption_set_parameters_read(os_disk.disk_encryption_set) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ShowHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_disk_encryption_set_parameters_read = None - - @classmethod - def _build_schema_disk_encryption_set_parameters_read(cls, _schema): - if cls._schema_disk_encryption_set_parameters_read is not None: - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - return - - cls._schema_disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read = AAZObjectType() - - disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read - disk_encryption_set_parameters_read.id = AAZStrType() - - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_update.py deleted file mode 100644 index f5368d972f8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_update.py +++ /dev/null @@ -1,550 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image update", -) -class Update(AAZCommand): - """Update custom VM images. - - :example: Add or update tags. - az image update -n ImageName -g ResourceGroup --tags tag1=val1 tag2=val2 - - :example: Remove all tags. - az image update -n ImageName -g resourceGroup --tags - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "Properties" - return cls._args_schema - - _args_disk_encryption_set_parameters_update = None - - @classmethod - def _build_args_disk_encryption_set_parameters_update(cls, _schema): - if cls._args_disk_encryption_set_parameters_update is not None: - _schema.id = cls._args_disk_encryption_set_parameters_update.id - return - - cls._args_disk_encryption_set_parameters_update = AAZObjectArg( - nullable=True, - ) - - disk_encryption_set_parameters_update = cls._args_disk_encryption_set_parameters_update - disk_encryption_set_parameters_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_disk_encryption_set_parameters_update.id - - _args_sub_resource_update = None - - @classmethod - def _build_args_sub_resource_update(cls, _schema): - if cls._args_sub_resource_update is not None: - _schema.id = cls._args_sub_resource_update.id - return - - cls._args_sub_resource_update = AAZObjectArg( - nullable=True, - ) - - sub_resource_update = cls._args_sub_resource_update - sub_resource_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_sub_resource_update.id - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.ImagesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_image_read(cls._schema_on_200) - - return cls._schema_on_200 - - class ImagesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_image_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_disk_encryption_set_parameters_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - @classmethod - def _build_schema_sub_resource_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_disk_encryption_set_parameters_read = None - - @classmethod - def _build_schema_disk_encryption_set_parameters_read(cls, _schema): - if cls._schema_disk_encryption_set_parameters_read is not None: - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - return - - cls._schema_disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read = AAZObjectType() - - disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read - disk_encryption_set_parameters_read.id = AAZStrType() - - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - - _schema_image_read = None - - @classmethod - def _build_schema_image_read(cls, _schema): - if cls._schema_image_read is not None: - _schema.id = cls._schema_image_read.id - _schema.location = cls._schema_image_read.location - _schema.name = cls._schema_image_read.name - _schema.properties = cls._schema_image_read.properties - _schema.tags = cls._schema_image_read.tags - _schema.type = cls._schema_image_read.type - return - - cls._schema_image_read = _schema_image_read = AAZObjectType() - - image_read = _schema_image_read - image_read.id = AAZStrType( - flags={"read_only": True}, - ) - image_read.location = AAZStrType( - flags={"required": True}, - ) - image_read.name = AAZStrType( - flags={"read_only": True}, - ) - image_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - image_read.tags = AAZDictType() - image_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_image_read.properties - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - cls._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = _schema_image_read.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = _schema_image_read.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = _schema_image_read.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - cls._build_schema_disk_encryption_set_parameters_read(_element.disk_encryption_set) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - cls._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - cls._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = _schema_image_read.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - cls._build_schema_disk_encryption_set_parameters_read(os_disk.disk_encryption_set) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - cls._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - cls._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = _schema_image_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_image_read.id - _schema.location = cls._schema_image_read.location - _schema.name = cls._schema_image_read.name - _schema.properties = cls._schema_image_read.properties - _schema.tags = cls._schema_image_read.tags - _schema.type = cls._schema_image_read.type - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_wait.py deleted file mode 100644 index d707f259659..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/image/_wait.py +++ /dev/null @@ -1,301 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "image wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/images/{}", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.image_name = AAZStrArg( - options=["-n", "--name", "--image-name"], - help="The name of the image.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ImagesGet(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=False) - return result - - class ImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "imageName", self.ctx.args.image_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.source_virtual_machine = AAZObjectType( - serialized_name="sourceVirtualMachine", - ) - _WaitHelper._build_schema_sub_resource_read(properties.source_virtual_machine) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - storage_profile = cls._schema_on_200.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - storage_profile.zone_resilient = AAZBoolType( - serialized_name="zoneResilient", - ) - - data_disks = cls._schema_on_200.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.storage_profile.data_disks.Element - _element.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - _element.caching = AAZStrType() - _element.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _WaitHelper._build_schema_disk_encryption_set_parameters_read(_element.disk_encryption_set) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _WaitHelper._build_schema_sub_resource_read(_element.managed_disk) - _element.snapshot = AAZObjectType() - _WaitHelper._build_schema_sub_resource_read(_element.snapshot) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - os_disk = cls._schema_on_200.properties.storage_profile.os_disk - os_disk.blob_uri = AAZStrType( - serialized_name="blobUri", - ) - os_disk.caching = AAZStrType() - os_disk.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - _WaitHelper._build_schema_disk_encryption_set_parameters_read(os_disk.disk_encryption_set) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _WaitHelper._build_schema_sub_resource_read(os_disk.managed_disk) - os_disk.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - os_disk.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - os_disk.snapshot = AAZObjectType() - _WaitHelper._build_schema_sub_resource_read(os_disk.snapshot) - os_disk.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_disk_encryption_set_parameters_read = None - - @classmethod - def _build_schema_disk_encryption_set_parameters_read(cls, _schema): - if cls._schema_disk_encryption_set_parameters_read is not None: - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - return - - cls._schema_disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read = AAZObjectType() - - disk_encryption_set_parameters_read = _schema_disk_encryption_set_parameters_read - disk_encryption_set_parameters_read.id = AAZStrType() - - _schema.id = cls._schema_disk_encryption_set_parameters_read.id - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/__cmd_group.py deleted file mode 100644 index 7582bb60b24..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/__cmd_group.py +++ /dev/null @@ -1,20 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage Azure Network resources. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/__init__.py deleted file mode 100644 index 5a9d61963d6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/__cmd_group.py deleted file mode 100644 index 4eb94459c8c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage application-level routing and load balancing services. - - To learn more about Application Gateway, visit https://learn.microsoft.com/en-us/azure/application-gateway/quick-create-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/__init__.py deleted file mode 100644 index 28d5f355813..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/_show.py deleted file mode 100644 index 98f6a6b7de5..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/application_gateway/_show.py +++ /dev/null @@ -1,2215 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of an application gateway. - - :example: Get the details of an application gateway. - az network application-gateway show -g MyResourceGroup -n MyAppGateway - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/applicationgateways/{}", "2018-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the application gateway.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ApplicationGatewaysGet(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 ApplicationGatewaysGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "applicationGatewayName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType() - _schema_on_200.id = AAZStrType() - _schema_on_200.identity = AAZObjectType() - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.zones = AAZListType() - - identity = cls._schema_on_200.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = cls._schema_on_200.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = cls._schema_on_200.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.authentication_certificates = AAZListType( - serialized_name="authenticationCertificates", - ) - properties.autoscale_configuration = AAZObjectType( - serialized_name="autoscaleConfiguration", - ) - properties.backend_address_pools = AAZListType( - serialized_name="backendAddressPools", - ) - properties.backend_http_settings_collection = AAZListType( - serialized_name="backendHttpSettingsCollection", - ) - properties.custom_error_configurations = AAZListType( - serialized_name="customErrorConfigurations", - ) - properties.enable_fips = AAZBoolType( - serialized_name="enableFips", - ) - properties.enable_http2 = AAZBoolType( - serialized_name="enableHttp2", - ) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - ) - properties.frontend_ports = AAZListType( - serialized_name="frontendPorts", - ) - properties.gateway_ip_configurations = AAZListType( - serialized_name="gatewayIPConfigurations", - ) - properties.http_listeners = AAZListType( - serialized_name="httpListeners", - ) - properties.operational_state = AAZStrType( - serialized_name="operationalState", - flags={"read_only": True}, - ) - properties.probes = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configurations = AAZListType( - serialized_name="redirectConfigurations", - ) - properties.request_routing_rules = AAZListType( - serialized_name="requestRoutingRules", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.rewrite_rule_sets = AAZListType( - serialized_name="rewriteRuleSets", - ) - properties.sku = AAZObjectType() - properties.ssl_certificates = AAZListType( - serialized_name="sslCertificates", - ) - properties.ssl_policy = AAZObjectType( - serialized_name="sslPolicy", - ) - properties.trusted_root_certificates = AAZListType( - serialized_name="trustedRootCertificates", - ) - properties.url_path_maps = AAZListType( - serialized_name="urlPathMaps", - ) - properties.web_application_firewall_configuration = AAZObjectType( - serialized_name="webApplicationFirewallConfiguration", - ) - - authentication_certificates = cls._schema_on_200.properties.authentication_certificates - authentication_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.authentication_certificates.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.authentication_certificates.Element.properties - properties.data = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - autoscale_configuration = cls._schema_on_200.properties.autoscale_configuration - autoscale_configuration.max_capacity = AAZIntType( - serialized_name="maxCapacity", - ) - autoscale_configuration.min_capacity = AAZIntType( - serialized_name="minCapacity", - flags={"required": True}, - ) - - backend_address_pools = cls._schema_on_200.properties.backend_address_pools - backend_address_pools.Element = AAZObjectType() - _ShowHelper._build_schema_application_gateway_backend_address_pool_read(backend_address_pools.Element) - - backend_http_settings_collection = cls._schema_on_200.properties.backend_http_settings_collection - backend_http_settings_collection.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.backend_http_settings_collection.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties - properties.affinity_cookie_name = AAZStrType( - serialized_name="affinityCookieName", - ) - properties.authentication_certificates = AAZListType( - serialized_name="authenticationCertificates", - ) - properties.connection_draining = AAZObjectType( - serialized_name="connectionDraining", - ) - properties.cookie_based_affinity = AAZStrType( - serialized_name="cookieBasedAffinity", - ) - properties.host_name = AAZStrType( - serialized_name="hostName", - ) - properties.path = AAZStrType() - properties.pick_host_name_from_backend_address = AAZBoolType( - serialized_name="pickHostNameFromBackendAddress", - ) - properties.port = AAZIntType() - properties.probe = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.probe) - properties.probe_enabled = AAZBoolType( - serialized_name="probeEnabled", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.request_timeout = AAZIntType( - serialized_name="requestTimeout", - ) - properties.trusted_root_certificates = AAZListType( - serialized_name="trustedRootCertificates", - ) - - authentication_certificates = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties.authentication_certificates - authentication_certificates.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(authentication_certificates.Element) - - connection_draining = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties.connection_draining - connection_draining.drain_timeout_in_sec = AAZIntType( - serialized_name="drainTimeoutInSec", - flags={"required": True}, - ) - connection_draining.enabled = AAZBoolType( - flags={"required": True}, - ) - - trusted_root_certificates = cls._schema_on_200.properties.backend_http_settings_collection.Element.properties.trusted_root_certificates - trusted_root_certificates.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(trusted_root_certificates.Element) - - custom_error_configurations = cls._schema_on_200.properties.custom_error_configurations - custom_error_configurations.Element = AAZObjectType() - _ShowHelper._build_schema_application_gateway_custom_error_read(custom_error_configurations.Element) - - frontend_ip_configurations = cls._schema_on_200.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.frontend_ip_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.frontend_ip_configurations.Element.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - _ShowHelper._build_schema_sub_resource_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.subnet) - - frontend_ports = cls._schema_on_200.properties.frontend_ports - frontend_ports.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.frontend_ports.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.frontend_ports.Element.properties - properties.port = AAZIntType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - gateway_ip_configurations = cls._schema_on_200.properties.gateway_ip_configurations - gateway_ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.gateway_ip_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.gateway_ip_configurations.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.subnet = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.subnet) - - http_listeners = cls._schema_on_200.properties.http_listeners - http_listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.http_listeners.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.http_listeners.Element.properties - properties.custom_error_configurations = AAZListType( - serialized_name="customErrorConfigurations", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZObjectType( - serialized_name="frontendPort", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_port) - properties.host_name = AAZStrType( - serialized_name="hostName", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.require_server_name_indication = AAZBoolType( - serialized_name="requireServerNameIndication", - ) - properties.ssl_certificate = AAZObjectType( - serialized_name="sslCertificate", - ) - _ShowHelper._build_schema_sub_resource_read(properties.ssl_certificate) - - custom_error_configurations = cls._schema_on_200.properties.http_listeners.Element.properties.custom_error_configurations - custom_error_configurations.Element = AAZObjectType() - _ShowHelper._build_schema_application_gateway_custom_error_read(custom_error_configurations.Element) - - probes = cls._schema_on_200.properties.probes - probes.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.probes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.probes.Element.properties - properties.host = AAZStrType() - properties.interval = AAZIntType() - properties.match = AAZObjectType() - properties.min_servers = AAZIntType( - serialized_name="minServers", - ) - properties.path = AAZStrType() - properties.pick_host_name_from_backend_http_settings = AAZBoolType( - serialized_name="pickHostNameFromBackendHttpSettings", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.timeout = AAZIntType() - properties.unhealthy_threshold = AAZIntType( - serialized_name="unhealthyThreshold", - ) - - match = cls._schema_on_200.properties.probes.Element.properties.match - match.body = AAZStrType() - match.status_codes = AAZListType( - serialized_name="statusCodes", - ) - - status_codes = cls._schema_on_200.properties.probes.Element.properties.match.status_codes - status_codes.Element = AAZStrType() - - redirect_configurations = cls._schema_on_200.properties.redirect_configurations - redirect_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.redirect_configurations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.redirect_configurations.Element.properties - properties.include_path = AAZBoolType( - serialized_name="includePath", - ) - properties.include_query_string = AAZBoolType( - serialized_name="includeQueryString", - ) - properties.path_rules = AAZListType( - serialized_name="pathRules", - ) - properties.redirect_type = AAZStrType( - serialized_name="redirectType", - ) - properties.request_routing_rules = AAZListType( - serialized_name="requestRoutingRules", - ) - properties.target_listener = AAZObjectType( - serialized_name="targetListener", - ) - _ShowHelper._build_schema_sub_resource_read(properties.target_listener) - properties.target_url = AAZStrType( - serialized_name="targetUrl", - ) - properties.url_path_maps = AAZListType( - serialized_name="urlPathMaps", - ) - - path_rules = cls._schema_on_200.properties.redirect_configurations.Element.properties.path_rules - path_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(path_rules.Element) - - request_routing_rules = cls._schema_on_200.properties.redirect_configurations.Element.properties.request_routing_rules - request_routing_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(request_routing_rules.Element) - - url_path_maps = cls._schema_on_200.properties.redirect_configurations.Element.properties.url_path_maps - url_path_maps.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(url_path_maps.Element) - - request_routing_rules = cls._schema_on_200.properties.request_routing_rules - request_routing_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.request_routing_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.request_routing_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_http_settings = AAZObjectType( - serialized_name="backendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_http_settings) - properties.http_listener = AAZObjectType( - serialized_name="httpListener", - ) - _ShowHelper._build_schema_sub_resource_read(properties.http_listener) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configuration = AAZObjectType( - serialized_name="redirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.redirect_configuration) - properties.rewrite_rule_set = AAZObjectType( - serialized_name="rewriteRuleSet", - ) - _ShowHelper._build_schema_sub_resource_read(properties.rewrite_rule_set) - properties.rule_type = AAZStrType( - serialized_name="ruleType", - ) - properties.url_path_map = AAZObjectType( - serialized_name="urlPathMap", - ) - _ShowHelper._build_schema_sub_resource_read(properties.url_path_map) - - rewrite_rule_sets = cls._schema_on_200.properties.rewrite_rule_sets - rewrite_rule_sets.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.rewrite_rule_sets.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.rewrite_rule_sets.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.rewrite_rules = AAZListType( - serialized_name="rewriteRules", - ) - - rewrite_rules = cls._schema_on_200.properties.rewrite_rule_sets.Element.properties.rewrite_rules - rewrite_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.rewrite_rule_sets.Element.properties.rewrite_rules.Element - _element.action_set = AAZObjectType( - serialized_name="actionSet", - ) - _element.name = AAZStrType() - - action_set = cls._schema_on_200.properties.rewrite_rule_sets.Element.properties.rewrite_rules.Element.action_set - action_set.request_header_configurations = AAZListType( - serialized_name="requestHeaderConfigurations", - ) - action_set.response_header_configurations = AAZListType( - serialized_name="responseHeaderConfigurations", - ) - - request_header_configurations = cls._schema_on_200.properties.rewrite_rule_sets.Element.properties.rewrite_rules.Element.action_set.request_header_configurations - request_header_configurations.Element = AAZObjectType() - _ShowHelper._build_schema_application_gateway_header_configuration_read(request_header_configurations.Element) - - response_header_configurations = cls._schema_on_200.properties.rewrite_rule_sets.Element.properties.rewrite_rules.Element.action_set.response_header_configurations - response_header_configurations.Element = AAZObjectType() - _ShowHelper._build_schema_application_gateway_header_configuration_read(response_header_configurations.Element) - - sku = cls._schema_on_200.properties.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - ssl_certificates = cls._schema_on_200.properties.ssl_certificates - ssl_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.ssl_certificates.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.ssl_certificates.Element.properties - properties.data = AAZStrType() - properties.key_vault_secret_id = AAZStrType( - serialized_name="keyVaultSecretId", - ) - properties.password = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_cert_data = AAZStrType( - serialized_name="publicCertData", - ) - - ssl_policy = cls._schema_on_200.properties.ssl_policy - ssl_policy.cipher_suites = AAZListType( - serialized_name="cipherSuites", - ) - ssl_policy.disabled_ssl_protocols = AAZListType( - serialized_name="disabledSslProtocols", - ) - ssl_policy.min_protocol_version = AAZStrType( - serialized_name="minProtocolVersion", - ) - ssl_policy.policy_name = AAZStrType( - serialized_name="policyName", - ) - ssl_policy.policy_type = AAZStrType( - serialized_name="policyType", - ) - - cipher_suites = cls._schema_on_200.properties.ssl_policy.cipher_suites - cipher_suites.Element = AAZStrType() - - disabled_ssl_protocols = cls._schema_on_200.properties.ssl_policy.disabled_ssl_protocols - disabled_ssl_protocols.Element = AAZStrType() - - trusted_root_certificates = cls._schema_on_200.properties.trusted_root_certificates - trusted_root_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.trusted_root_certificates.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.trusted_root_certificates.Element.properties - properties.data = AAZStrType() - properties.key_vault_secret_id = AAZStrType( - serialized_name="keyVaultSecretId", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - url_path_maps = cls._schema_on_200.properties.url_path_maps - url_path_maps.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.url_path_maps.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.url_path_maps.Element.properties - properties.default_backend_address_pool = AAZObjectType( - serialized_name="defaultBackendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_backend_address_pool) - properties.default_backend_http_settings = AAZObjectType( - serialized_name="defaultBackendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_backend_http_settings) - properties.default_redirect_configuration = AAZObjectType( - serialized_name="defaultRedirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_redirect_configuration) - properties.default_rewrite_rule_set = AAZObjectType( - serialized_name="defaultRewriteRuleSet", - ) - _ShowHelper._build_schema_sub_resource_read(properties.default_rewrite_rule_set) - properties.path_rules = AAZListType( - serialized_name="pathRules", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - path_rules = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules - path_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_http_settings = AAZObjectType( - serialized_name="backendHttpSettings", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_http_settings) - properties.paths = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.redirect_configuration = AAZObjectType( - serialized_name="redirectConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.redirect_configuration) - properties.rewrite_rule_set = AAZObjectType( - serialized_name="rewriteRuleSet", - ) - _ShowHelper._build_schema_sub_resource_read(properties.rewrite_rule_set) - - paths = cls._schema_on_200.properties.url_path_maps.Element.properties.path_rules.Element.properties.paths - paths.Element = AAZStrType() - - web_application_firewall_configuration = cls._schema_on_200.properties.web_application_firewall_configuration - web_application_firewall_configuration.disabled_rule_groups = AAZListType( - serialized_name="disabledRuleGroups", - ) - web_application_firewall_configuration.enabled = AAZBoolType( - flags={"required": True}, - ) - web_application_firewall_configuration.exclusions = AAZListType() - web_application_firewall_configuration.file_upload_limit_in_mb = AAZIntType( - serialized_name="fileUploadLimitInMb", - ) - web_application_firewall_configuration.firewall_mode = AAZStrType( - serialized_name="firewallMode", - flags={"required": True}, - ) - web_application_firewall_configuration.max_request_body_size = AAZIntType( - serialized_name="maxRequestBodySize", - ) - web_application_firewall_configuration.max_request_body_size_in_kb = AAZIntType( - serialized_name="maxRequestBodySizeInKb", - ) - web_application_firewall_configuration.request_body_check = AAZBoolType( - serialized_name="requestBodyCheck", - ) - web_application_firewall_configuration.rule_set_type = AAZStrType( - serialized_name="ruleSetType", - flags={"required": True}, - ) - web_application_firewall_configuration.rule_set_version = AAZStrType( - serialized_name="ruleSetVersion", - flags={"required": True}, - ) - - disabled_rule_groups = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups - disabled_rule_groups.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups.Element - _element.rule_group_name = AAZStrType( - serialized_name="ruleGroupName", - flags={"required": True}, - ) - _element.rules = AAZListType() - - rules = cls._schema_on_200.properties.web_application_firewall_configuration.disabled_rule_groups.Element.rules - rules.Element = AAZIntType() - - exclusions = cls._schema_on_200.properties.web_application_firewall_configuration.exclusions - exclusions.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.web_application_firewall_configuration.exclusions.Element - _element.match_variable = AAZStrType( - serialized_name="matchVariable", - flags={"required": True}, - ) - _element.selector = AAZStrType( - flags={"required": True}, - ) - _element.selector_match_operator = AAZStrType( - serialized_name="selectorMatchOperator", - flags={"required": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_gateway_backend_address_pool_read = None - - @classmethod - def _build_schema_application_gateway_backend_address_pool_read(cls, _schema): - if cls._schema_application_gateway_backend_address_pool_read is not None: - _schema.etag = cls._schema_application_gateway_backend_address_pool_read.etag - _schema.id = cls._schema_application_gateway_backend_address_pool_read.id - _schema.name = cls._schema_application_gateway_backend_address_pool_read.name - _schema.properties = cls._schema_application_gateway_backend_address_pool_read.properties - _schema.type = cls._schema_application_gateway_backend_address_pool_read.type - return - - cls._schema_application_gateway_backend_address_pool_read = _schema_application_gateway_backend_address_pool_read = AAZObjectType() - - application_gateway_backend_address_pool_read = _schema_application_gateway_backend_address_pool_read - application_gateway_backend_address_pool_read.etag = AAZStrType() - application_gateway_backend_address_pool_read.id = AAZStrType() - application_gateway_backend_address_pool_read.name = AAZStrType() - application_gateway_backend_address_pool_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_gateway_backend_address_pool_read.type = AAZStrType() - - properties = _schema_application_gateway_backend_address_pool_read.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_application_gateway_backend_address_pool_read.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_application_gateway_backend_address_pool_read.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_application_gateway_backend_address_pool_read.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - _schema.etag = cls._schema_application_gateway_backend_address_pool_read.etag - _schema.id = cls._schema_application_gateway_backend_address_pool_read.id - _schema.name = cls._schema_application_gateway_backend_address_pool_read.name - _schema.properties = cls._schema_application_gateway_backend_address_pool_read.properties - _schema.type = cls._schema_application_gateway_backend_address_pool_read.type - - _schema_application_gateway_custom_error_read = None - - @classmethod - def _build_schema_application_gateway_custom_error_read(cls, _schema): - if cls._schema_application_gateway_custom_error_read is not None: - _schema.custom_error_page_url = cls._schema_application_gateway_custom_error_read.custom_error_page_url - _schema.status_code = cls._schema_application_gateway_custom_error_read.status_code - return - - cls._schema_application_gateway_custom_error_read = _schema_application_gateway_custom_error_read = AAZObjectType() - - application_gateway_custom_error_read = _schema_application_gateway_custom_error_read - application_gateway_custom_error_read.custom_error_page_url = AAZStrType( - serialized_name="customErrorPageUrl", - ) - application_gateway_custom_error_read.status_code = AAZStrType( - serialized_name="statusCode", - ) - - _schema.custom_error_page_url = cls._schema_application_gateway_custom_error_read.custom_error_page_url - _schema.status_code = cls._schema_application_gateway_custom_error_read.status_code - - _schema_application_gateway_header_configuration_read = None - - @classmethod - def _build_schema_application_gateway_header_configuration_read(cls, _schema): - if cls._schema_application_gateway_header_configuration_read is not None: - _schema.header_name = cls._schema_application_gateway_header_configuration_read.header_name - _schema.header_value = cls._schema_application_gateway_header_configuration_read.header_value - return - - cls._schema_application_gateway_header_configuration_read = _schema_application_gateway_header_configuration_read = AAZObjectType() - - application_gateway_header_configuration_read = _schema_application_gateway_header_configuration_read - application_gateway_header_configuration_read.header_name = AAZStrType( - serialized_name="headerName", - ) - application_gateway_header_configuration_read.header_value = AAZStrType( - serialized_name="headerValue", - ) - - _schema.header_name = cls._schema_application_gateway_header_configuration_read.header_name - _schema.header_value = cls._schema_application_gateway_header_configuration_read.header_value - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - cls._build_schema_application_gateway_backend_address_pool_read(application_gateway_backend_address_pools.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/__cmd_group.py deleted file mode 100644 index 9b5c68b709c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage and configure load balancers. - - To learn more about Azure Load Balancer visit https://learn.microsoft.com/en-us/azure/load-balancer/quickstart-load-balancer-standard-public-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/__init__.py deleted file mode 100644 index 28d5f355813..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/_show.py deleted file mode 100644 index 696b8e39527..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/lb/_show.py +++ /dev/null @@ -1,1729 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a load balancer. - - :example: Get the details of a load balancer. - az network lb show -g MyResourceGroup -n MyLb - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/loadbalancers/{}", "2018-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The load balancer name.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.LoadBalancersGet(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 LoadBalancersGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "loadBalancerName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType() - _schema_on_200.id = AAZStrType() - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.backend_address_pools = AAZListType( - serialized_name="backendAddressPools", - ) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - ) - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - ) - properties.probes = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - backend_address_pools = cls._schema_on_200.properties.backend_address_pools - backend_address_pools.Element = AAZObjectType() - _ShowHelper._build_schema_backend_address_pool_read(backend_address_pools.Element) - - frontend_ip_configurations = cls._schema_on_200.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - _ShowHelper._build_schema_frontend_ip_configuration_read(frontend_ip_configurations.Element) - - inbound_nat_pools = cls._schema_on_200.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.inbound_nat_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.inbound_nat_pools.Element.properties - properties.backend_port = AAZIntType( - serialized_name="backendPort", - flags={"required": True}, - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port_range_end = AAZIntType( - serialized_name="frontendPortRangeEnd", - flags={"required": True}, - ) - properties.frontend_port_range_start = AAZIntType( - serialized_name="frontendPortRangeStart", - flags={"required": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - inbound_nat_rules = cls._schema_on_200.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - _ShowHelper._build_schema_inbound_nat_rule_read(inbound_nat_rules.Element) - - load_balancing_rules = cls._schema_on_200.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.load_balancing_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.load_balancing_rules.Element.properties - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.disable_outbound_snat = AAZBoolType( - serialized_name="disableOutboundSnat", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - _ShowHelper._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - flags={"required": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.load_distribution = AAZStrType( - serialized_name="loadDistribution", - ) - properties.probe = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.probe) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - outbound_rules = cls._schema_on_200.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.outbound_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.outbound_rules.Element.properties - properties.allocated_outbound_ports = AAZIntType( - serialized_name="allocatedOutboundPorts", - ) - properties.backend_address_pool = AAZObjectType( - serialized_name="backendAddressPool", - flags={"required": True}, - ) - _ShowHelper._build_schema_sub_resource_read(properties.backend_address_pool) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configurations = AAZListType( - serialized_name="frontendIPConfigurations", - flags={"required": True}, - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - frontend_ip_configurations = cls._schema_on_200.properties.outbound_rules.Element.properties.frontend_ip_configurations - frontend_ip_configurations.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(frontend_ip_configurations.Element) - - probes = cls._schema_on_200.properties.probes - probes.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.probes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.properties.probes.Element.properties - properties.interval_in_seconds = AAZIntType( - serialized_name="intervalInSeconds", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.number_of_probes = AAZIntType( - serialized_name="numberOfProbes", - ) - properties.port = AAZIntType( - flags={"required": True}, - ) - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.request_path = AAZStrType( - serialized_name="requestPath", - ) - - load_balancing_rules = cls._schema_on_200.properties.probes.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(load_balancing_rules.Element) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_backend_address_pool_read = None - - @classmethod - def _build_schema_backend_address_pool_read(cls, _schema): - if cls._schema_backend_address_pool_read is not None: - _schema.etag = cls._schema_backend_address_pool_read.etag - _schema.id = cls._schema_backend_address_pool_read.id - _schema.name = cls._schema_backend_address_pool_read.name - _schema.properties = cls._schema_backend_address_pool_read.properties - return - - cls._schema_backend_address_pool_read = _schema_backend_address_pool_read = AAZObjectType() - - backend_address_pool_read = _schema_backend_address_pool_read - backend_address_pool_read.etag = AAZStrType() - backend_address_pool_read.id = AAZStrType() - backend_address_pool_read.name = AAZStrType() - backend_address_pool_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_backend_address_pool_read.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_backend_address_pool_read.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_backend_address_pool_read.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_backend_address_pool_read.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - _schema.etag = cls._schema_backend_address_pool_read.etag - _schema.id = cls._schema_backend_address_pool_read.id - _schema.name = cls._schema_backend_address_pool_read.name - _schema.properties = cls._schema_backend_address_pool_read.properties - - _schema_frontend_ip_configuration_read = None - - @classmethod - def _build_schema_frontend_ip_configuration_read(cls, _schema): - if cls._schema_frontend_ip_configuration_read is not None: - _schema.etag = cls._schema_frontend_ip_configuration_read.etag - _schema.id = cls._schema_frontend_ip_configuration_read.id - _schema.name = cls._schema_frontend_ip_configuration_read.name - _schema.properties = cls._schema_frontend_ip_configuration_read.properties - _schema.zones = cls._schema_frontend_ip_configuration_read.zones - return - - cls._schema_frontend_ip_configuration_read = _schema_frontend_ip_configuration_read = AAZObjectType() - - frontend_ip_configuration_read = _schema_frontend_ip_configuration_read - frontend_ip_configuration_read.etag = AAZStrType() - frontend_ip_configuration_read.id = AAZStrType() - frontend_ip_configuration_read.name = AAZStrType() - frontend_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - frontend_ip_configuration_read.zones = AAZListType() - - properties = _schema_frontend_ip_configuration_read.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_frontend_ip_configuration_read.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_frontend_ip_configuration_read.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_frontend_ip_configuration_read.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_frontend_ip_configuration_read.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_frontend_ip_configuration_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_frontend_ip_configuration_read.etag - _schema.id = cls._schema_frontend_ip_configuration_read.id - _schema.name = cls._schema_frontend_ip_configuration_read.name - _schema.properties = cls._schema_frontend_ip_configuration_read.properties - _schema.zones = cls._schema_frontend_ip_configuration_read.zones - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_inbound_nat_rule_read = None - - @classmethod - def _build_schema_inbound_nat_rule_read(cls, _schema): - if cls._schema_inbound_nat_rule_read is not None: - _schema.etag = cls._schema_inbound_nat_rule_read.etag - _schema.id = cls._schema_inbound_nat_rule_read.id - _schema.name = cls._schema_inbound_nat_rule_read.name - _schema.properties = cls._schema_inbound_nat_rule_read.properties - return - - cls._schema_inbound_nat_rule_read = _schema_inbound_nat_rule_read = AAZObjectType() - - inbound_nat_rule_read = _schema_inbound_nat_rule_read - inbound_nat_rule_read.etag = AAZStrType() - inbound_nat_rule_read.id = AAZStrType() - inbound_nat_rule_read.name = AAZStrType() - inbound_nat_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_inbound_nat_rule_read.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_inbound_nat_rule_read.etag - _schema.id = cls._schema_inbound_nat_rule_read.id - _schema.name = cls._schema_inbound_nat_rule_read.name - _schema.properties = cls._schema_inbound_nat_rule_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - cls._build_schema_backend_address_pool_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_inbound_nat_rule_read(load_balancer_inbound_nat_rules.Element) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - cls._build_schema_frontend_ip_configuration_read(properties.destination_load_balancer_front_end_ip_configuration) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/__cmd_group.py deleted file mode 100644 index 7d71d8c1f92..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage network interfaces. - - To learn more about network interfaces in Azure, visit https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-network-interface?tabs=network-interface-portal. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/__init__.py deleted file mode 100644 index bee768f7653..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_list.py deleted file mode 100644 index 9f3dde14f4e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_list.py +++ /dev/null @@ -1,1520 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List network interfaces. - - To list network interfaces attached to VMs in VM scale sets use `az vmss nic list` or `az vmss nic list-vm-nics`. - - :example: List all NICs by internal DNS suffix. - az network nic list --query "[?dnsSettings.internalDomainNameSuffix=`{dnsSuffix}`]" - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/networkinterfaces", "2018-11-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces", "2018-11-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.NetworkInterfacesList(ctx=self.ctx)() - if condition_1: - self.NetworkInterfacesListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - flags={"read_only": True}, - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - class NetworkInterfacesListAll(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.Network/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - flags={"read_only": True}, - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_show.py deleted file mode 100644 index 594dc0e468a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_show.py +++ /dev/null @@ -1,1436 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a network interface. - - :example: Get the internal domain name suffix of a NIC. - az network nic show -g MyResourceGroup -n MyNic --query "dnsSettings.internalDomainNameSuffix" - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces/{}", "2018-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network interface (NIC).", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGet(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 NetworkInterfacesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_update.py deleted file mode 100644 index 9df6fb8fa8f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nic/_update.py +++ /dev/null @@ -1,4047 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Update(AAZCommand): - """Update a network interface. - - :example: Update a network interface to use a different network security group. - az network nic update -g MyResourceGroup -n MyNic --network-security-group MyNewNsg - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkinterfaces/{}", "2018-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network interface (NIC).", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.accelerated_networking = AAZBoolArg( - options=["--accelerated-networking"], - help="Whether to enable accelerated networking.", - nullable=True, - ) - _args_schema.ip_forwarding = AAZBoolArg( - options=["--ip-forwarding"], - help="Whether to enable IP forwarding.", - nullable=True, - ) - - # define Arg Group "DNS" - - _args_schema = cls._args_schema - _args_schema.dns_servers = AAZListArg( - options=["--dns-servers"], - arg_group="DNS", - help="Space-separated list of DNS server IP addresses. Use null to revert to default Azure servers.", - nullable=True, - ) - _args_schema.internal_dns_name = AAZStrArg( - options=["--internal-dns-name"], - arg_group="DNS", - help="Name of internal DNS label.", - nullable=True, - ) - - dns_servers = cls._args_schema.dns_servers - dns_servers.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "DnsSettings" - - # define Arg Group "Parameters" - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.nsg = AAZObjectArg( - options=["--nsg"], - arg_group="Properties", - help="The reference to the NetworkSecurityGroup resource.", - nullable=True, - ) - _args_schema.tap_configurations = AAZListArg( - options=["--tap-configurations"], - arg_group="Properties", - help="A list of TapConfigurations of the network interface.", - nullable=True, - ) - - nsg = cls._args_schema.nsg - nsg.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - nsg.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - nsg.security_rules = AAZListArg( - options=["security-rules"], - help="A collection of security rules of the network security group.", - nullable=True, - ) - nsg.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - security_rules = cls._args_schema.nsg.security_rules - security_rules.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.nsg.security_rules.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - _element.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - _element.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - _element.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - _element.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - _element.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _element.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - _element.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - _element.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.", - nullable=True, - ) - _element.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - _element.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - _element.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - nullable=True, - ) - _element.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_schema.nsg.security_rules.Element.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_schema.nsg.security_rules.Element.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_schema.nsg.security_rules.Element.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_schema.nsg.security_rules.Element.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_schema.nsg.security_rules.Element.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_schema.nsg.security_rules.Element.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_schema.nsg.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - tap_configurations = cls._args_schema.tap_configurations - tap_configurations.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.tap_configurations.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkInterfaces/{}/tapConfigurations/{}", - ), - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.virtual_network_tap = AAZObjectArg( - options=["virtual-network-tap"], - help="The reference of the Virtual Network Tap resource.", - nullable=True, - ) - cls._build_args_virtual_network_tap_update(_element.virtual_network_tap) - return cls._args_schema - - _args_application_security_group_update = None - - @classmethod - def _build_args_application_security_group_update(cls, _schema): - if cls._args_application_security_group_update is not None: - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - return - - cls._args_application_security_group_update = AAZObjectArg( - nullable=True, - ) - - application_security_group_update = cls._args_application_security_group_update - application_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_application_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - - _args_network_interface_ip_configuration_update = None - - @classmethod - def _build_args_network_interface_ip_configuration_update(cls, _schema): - if cls._args_network_interface_ip_configuration_update is not None: - _schema.application_gateway_backend_address_pools = cls._args_network_interface_ip_configuration_update.application_gateway_backend_address_pools - _schema.application_security_groups = cls._args_network_interface_ip_configuration_update.application_security_groups - _schema.load_balancer_backend_address_pools = cls._args_network_interface_ip_configuration_update.load_balancer_backend_address_pools - _schema.load_balancer_inbound_nat_rules = cls._args_network_interface_ip_configuration_update.load_balancer_inbound_nat_rules - _schema.name = cls._args_network_interface_ip_configuration_update.name - _schema.primary = cls._args_network_interface_ip_configuration_update.primary - _schema.private_ip_address = cls._args_network_interface_ip_configuration_update.private_ip_address - _schema.private_ip_address_version = cls._args_network_interface_ip_configuration_update.private_ip_address_version - _schema.private_ip_allocation_method = cls._args_network_interface_ip_configuration_update.private_ip_allocation_method - _schema.public_ip_address = cls._args_network_interface_ip_configuration_update.public_ip_address - _schema.subnet = cls._args_network_interface_ip_configuration_update.subnet - _schema.virtual_network_taps = cls._args_network_interface_ip_configuration_update.virtual_network_taps - return - - cls._args_network_interface_ip_configuration_update = AAZObjectArg( - nullable=True, - ) - - network_interface_ip_configuration_update = cls._args_network_interface_ip_configuration_update - network_interface_ip_configuration_update.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - network_interface_ip_configuration_update.application_gateway_backend_address_pools = AAZListArg( - options=["application-gateway-backend-address-pools"], - help="The reference of ApplicationGatewayBackendAddressPool resource.", - nullable=True, - ) - network_interface_ip_configuration_update.application_security_groups = AAZListArg( - options=["application-security-groups"], - help="Application security groups in which the IP configuration is included.", - nullable=True, - ) - network_interface_ip_configuration_update.load_balancer_backend_address_pools = AAZListArg( - options=["load-balancer-backend-address-pools"], - help="The reference of LoadBalancerBackendAddressPool resource.", - nullable=True, - ) - network_interface_ip_configuration_update.load_balancer_inbound_nat_rules = AAZListArg( - options=["load-balancer-inbound-nat-rules"], - help="A list of references of LoadBalancerInboundNatRules.", - nullable=True, - ) - network_interface_ip_configuration_update.primary = AAZBoolArg( - options=["primary"], - help="Gets whether this is a primary customer address on the network interface.", - nullable=True, - ) - network_interface_ip_configuration_update.private_ip_address = AAZStrArg( - options=["private-ip-address"], - help="Private IP address of the IP configuration.", - nullable=True, - ) - network_interface_ip_configuration_update.private_ip_address_version = AAZStrArg( - options=["private-ip-address-version"], - help="Available from Api-Version 2016-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'.", - nullable=True, - enum={"IPv4": "IPv4", "IPv6": "IPv6"}, - ) - network_interface_ip_configuration_update.private_ip_allocation_method = AAZStrArg( - options=["private-ip-allocation-method"], - help="Defines how a private IP address is assigned. Possible values are: 'Static' and 'Dynamic'.", - nullable=True, - enum={"Dynamic": "Dynamic", "Static": "Static"}, - ) - network_interface_ip_configuration_update.public_ip_address = AAZObjectArg( - options=["public-ip-address"], - help="Public IP address bound to the IP configuration.", - nullable=True, - ) - cls._build_args_public_ip_address_update(network_interface_ip_configuration_update.public_ip_address) - network_interface_ip_configuration_update.subnet = AAZObjectArg( - options=["subnet"], - help="Subnet bound to the IP configuration.", - nullable=True, - ) - cls._build_args_subnet_update(network_interface_ip_configuration_update.subnet) - network_interface_ip_configuration_update.virtual_network_taps = AAZListArg( - options=["virtual-network-taps"], - help="The reference to Virtual Network Taps.", - nullable=True, - ) - - application_gateway_backend_address_pools = cls._args_network_interface_ip_configuration_update.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_network_interface_ip_configuration_update.application_gateway_backend_address_pools.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="Name of the backend address pool that is unique within an Application Gateway.", - nullable=True, - ) - _element.backend_addresses = AAZListArg( - options=["backend-addresses"], - help="Backend addresses", - nullable=True, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="Provisioning state of the backend address pool resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - _element.type = AAZStrArg( - options=["type"], - help="Type of the resource.", - nullable=True, - ) - - backend_addresses = cls._args_network_interface_ip_configuration_update.application_gateway_backend_address_pools.Element.backend_addresses - backend_addresses.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_network_interface_ip_configuration_update.application_gateway_backend_address_pools.Element.backend_addresses.Element - _element.fqdn = AAZStrArg( - options=["fqdn"], - help="Fully qualified domain name (FQDN).", - nullable=True, - ) - _element.ip_address = AAZStrArg( - options=["ip-address"], - help="IP address", - nullable=True, - ) - - application_security_groups = cls._args_network_interface_ip_configuration_update.application_security_groups - application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(application_security_groups.Element) - - load_balancer_backend_address_pools = cls._args_network_interface_ip_configuration_update.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_network_interface_ip_configuration_update.load_balancer_backend_address_pools.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/backendAddressPools/{}", - ), - ) - _element.name = AAZStrArg( - options=["name"], - help="Gets name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="Get provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - - load_balancer_inbound_nat_rules = cls._args_network_interface_ip_configuration_update.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_network_interface_ip_configuration_update.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/inboundNatRules/{}", - ), - ) - _element.name = AAZStrArg( - options=["name"], - help="Gets name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.backend_port = AAZIntArg( - options=["backend-port"], - help="The port used for the internal endpoint. Acceptable values range from 1 to 65535.", - nullable=True, - ) - _element.enable_floating_ip = AAZBoolArg( - options=["enable-floating-ip"], - help="Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint.", - nullable=True, - ) - _element.enable_tcp_reset = AAZBoolArg( - options=["enable-tcp-reset"], - help="Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP.", - nullable=True, - ) - _element.frontend_ip_configuration = AAZObjectArg( - options=["frontend-ip-configuration"], - help="A reference to frontend IP addresses.", - nullable=True, - ) - cls._build_args_sub_resource_update(_element.frontend_ip_configuration) - _element.frontend_port = AAZIntArg( - options=["frontend-port"], - help="The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values range from 1 to 65534.", - nullable=True, - ) - _element.idle_timeout_in_minutes = AAZIntArg( - options=["idle-timeout-in-minutes"], - help="The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP.", - nullable=True, - ) - _element.protocol = AAZStrArg( - options=["protocol"], - help="The transport protocol for the endpoint. Possible values are 'Udp' or 'Tcp' or 'All'.", - nullable=True, - enum={"All": "All", "Tcp": "Tcp", "Udp": "Udp"}, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="Gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - - virtual_network_taps = cls._args_network_interface_ip_configuration_update.virtual_network_taps - virtual_network_taps.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_network_interface_ip_configuration_update.virtual_network_taps.Element - _element.etag = AAZStrArg( - options=["etag"], - help="Gets a unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkTaps/{}", - ), - ) - _element.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _element.destination_load_balancer_front_end_ip_configuration = AAZObjectArg( - options=["destination-load-balancer-front-end-ip-configuration"], - help="The reference to the private IP address on the internal Load Balancer that will receive the tap", - nullable=True, - ) - _element.destination_network_interface_ip_configuration = AAZObjectArg( - options=["destination-network-interface-ip-configuration"], - help="The reference to the private IP Address of the collector nic that will receive the tap", - nullable=True, - ) - cls._build_args_network_interface_ip_configuration_update(_element.destination_network_interface_ip_configuration) - _element.destination_port = AAZIntArg( - options=["destination-port"], - help="The VXLAN destination port that will receive the tapped traffic.", - nullable=True, - ) - _element.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - destination_load_balancer_front_end_ip_configuration = cls._args_network_interface_ip_configuration_update.virtual_network_taps.Element.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - destination_load_balancer_front_end_ip_configuration.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}", - ), - ) - destination_load_balancer_front_end_ip_configuration.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - destination_load_balancer_front_end_ip_configuration.private_ip_address = AAZStrArg( - options=["private-ip-address"], - help="The private IP address of the IP configuration.", - nullable=True, - ) - destination_load_balancer_front_end_ip_configuration.private_ip_allocation_method = AAZStrArg( - options=["private-ip-allocation-method"], - help="The Private IP allocation method. Possible values are: 'Static' and 'Dynamic'.", - nullable=True, - enum={"Dynamic": "Dynamic", "Static": "Static"}, - ) - destination_load_balancer_front_end_ip_configuration.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="Gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - destination_load_balancer_front_end_ip_configuration.public_ip_address = AAZObjectArg( - options=["public-ip-address"], - help="The reference of the Public IP resource.", - nullable=True, - ) - cls._build_args_public_ip_address_update(destination_load_balancer_front_end_ip_configuration.public_ip_address) - destination_load_balancer_front_end_ip_configuration.public_ip_prefix = AAZObjectArg( - options=["public-ip-prefix"], - help="The reference of the Public IP Prefix resource.", - nullable=True, - ) - cls._build_args_sub_resource_update(destination_load_balancer_front_end_ip_configuration.public_ip_prefix) - destination_load_balancer_front_end_ip_configuration.subnet = AAZObjectArg( - options=["subnet"], - help="The reference of the subnet resource.", - nullable=True, - ) - cls._build_args_subnet_update(destination_load_balancer_front_end_ip_configuration.subnet) - destination_load_balancer_front_end_ip_configuration.zones = AAZListArg( - options=["zones"], - help="A list of availability zones denoting the IP allocated for the resource needs to come from.", - nullable=True, - ) - - zones = cls._args_network_interface_ip_configuration_update.virtual_network_taps.Element.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_network_interface_ip_configuration_update.virtual_network_taps.Element.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.application_gateway_backend_address_pools = cls._args_network_interface_ip_configuration_update.application_gateway_backend_address_pools - _schema.application_security_groups = cls._args_network_interface_ip_configuration_update.application_security_groups - _schema.load_balancer_backend_address_pools = cls._args_network_interface_ip_configuration_update.load_balancer_backend_address_pools - _schema.load_balancer_inbound_nat_rules = cls._args_network_interface_ip_configuration_update.load_balancer_inbound_nat_rules - _schema.name = cls._args_network_interface_ip_configuration_update.name - _schema.primary = cls._args_network_interface_ip_configuration_update.primary - _schema.private_ip_address = cls._args_network_interface_ip_configuration_update.private_ip_address - _schema.private_ip_address_version = cls._args_network_interface_ip_configuration_update.private_ip_address_version - _schema.private_ip_allocation_method = cls._args_network_interface_ip_configuration_update.private_ip_allocation_method - _schema.public_ip_address = cls._args_network_interface_ip_configuration_update.public_ip_address - _schema.subnet = cls._args_network_interface_ip_configuration_update.subnet - _schema.virtual_network_taps = cls._args_network_interface_ip_configuration_update.virtual_network_taps - - _args_network_security_group_update = None - - @classmethod - def _build_args_network_security_group_update(cls, _schema): - if cls._args_network_security_group_update is not None: - _schema.default_security_rules = cls._args_network_security_group_update.default_security_rules - _schema.etag = cls._args_network_security_group_update.etag - _schema.id = cls._args_network_security_group_update.id - _schema.location = cls._args_network_security_group_update.location - _schema.provisioning_state = cls._args_network_security_group_update.provisioning_state - _schema.resource_guid = cls._args_network_security_group_update.resource_guid - _schema.security_rules = cls._args_network_security_group_update.security_rules - _schema.tags = cls._args_network_security_group_update.tags - return - - cls._args_network_security_group_update = AAZObjectArg( - nullable=True, - ) - - network_security_group_update = cls._args_network_security_group_update - network_security_group_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - network_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - network_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - network_security_group_update.default_security_rules = AAZListArg( - options=["default-security-rules"], - help="The default security rules of network security group.", - nullable=True, - ) - network_security_group_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - network_security_group_update.resource_guid = AAZStrArg( - options=["resource-guid"], - help="The resource GUID property of the network security group resource.", - nullable=True, - ) - network_security_group_update.security_rules = AAZListArg( - options=["security-rules"], - help="A collection of security rules of the network security group.", - nullable=True, - ) - network_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - default_security_rules = cls._args_network_security_group_update.default_security_rules - default_security_rules.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_security_rule_update(default_security_rules.Element) - - security_rules = cls._args_network_security_group_update.security_rules - security_rules.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_network_security_group_update.security_rules.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - _element.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - _element.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - _element.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - _element.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - _element.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - _element.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _element.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - _element.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - _element.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - _element.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - _element.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - _element.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - _element.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_network_security_group_update.security_rules.Element.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_network_security_group_update.security_rules.Element.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_network_security_group_update.security_rules.Element.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_network_security_group_update.security_rules.Element.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_network_security_group_update.security_rules.Element.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_network_security_group_update.security_rules.Element.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_network_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.default_security_rules = cls._args_network_security_group_update.default_security_rules - _schema.etag = cls._args_network_security_group_update.etag - _schema.id = cls._args_network_security_group_update.id - _schema.location = cls._args_network_security_group_update.location - _schema.provisioning_state = cls._args_network_security_group_update.provisioning_state - _schema.resource_guid = cls._args_network_security_group_update.resource_guid - _schema.security_rules = cls._args_network_security_group_update.security_rules - _schema.tags = cls._args_network_security_group_update.tags - - _args_public_ip_address_update = None - - @classmethod - def _build_args_public_ip_address_update(cls, _schema): - if cls._args_public_ip_address_update is not None: - _schema.ddos_settings = cls._args_public_ip_address_update.ddos_settings - _schema.dns_settings = cls._args_public_ip_address_update.dns_settings - _schema.etag = cls._args_public_ip_address_update.etag - _schema.id = cls._args_public_ip_address_update.id - _schema.idle_timeout_in_minutes = cls._args_public_ip_address_update.idle_timeout_in_minutes - _schema.ip_address = cls._args_public_ip_address_update.ip_address - _schema.ip_tags = cls._args_public_ip_address_update.ip_tags - _schema.location = cls._args_public_ip_address_update.location - _schema.provisioning_state = cls._args_public_ip_address_update.provisioning_state - _schema.public_ip_address_version = cls._args_public_ip_address_update.public_ip_address_version - _schema.public_ip_allocation_method = cls._args_public_ip_address_update.public_ip_allocation_method - _schema.public_ip_prefix = cls._args_public_ip_address_update.public_ip_prefix - _schema.resource_guid = cls._args_public_ip_address_update.resource_guid - _schema.sku = cls._args_public_ip_address_update.sku - _schema.tags = cls._args_public_ip_address_update.tags - _schema.zones = cls._args_public_ip_address_update.zones - return - - cls._args_public_ip_address_update = AAZObjectArg( - nullable=True, - ) - - public_ip_address_update = cls._args_public_ip_address_update - public_ip_address_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - public_ip_address_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPAddresses/{}", - ), - ) - public_ip_address_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - public_ip_address_update.ddos_settings = AAZObjectArg( - options=["ddos-settings"], - help="The DDoS protection custom policy associated with the public IP address.", - nullable=True, - ) - public_ip_address_update.dns_settings = AAZObjectArg( - options=["dns-settings"], - help="The FQDN of the DNS record associated with the public IP address.", - nullable=True, - ) - public_ip_address_update.idle_timeout_in_minutes = AAZIntArg( - options=["idle-timeout-in-minutes"], - help="The idle timeout of the public IP address.", - nullable=True, - ) - public_ip_address_update.ip_address = AAZStrArg( - options=["ip-address"], - help="The IP address associated with the public IP address resource.", - nullable=True, - ) - public_ip_address_update.ip_tags = AAZListArg( - options=["ip-tags"], - help="The list of tags associated with the public IP address.", - nullable=True, - ) - public_ip_address_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - public_ip_address_update.public_ip_address_version = AAZStrArg( - options=["public-ip-address-version"], - help="The public IP address version. Possible values are: 'IPv4' and 'IPv6'.", - nullable=True, - enum={"IPv4": "IPv4", "IPv6": "IPv6"}, - ) - public_ip_address_update.public_ip_allocation_method = AAZStrArg( - options=["public-ip-allocation-method"], - help="The public IP allocation method. Possible values are: 'Static' and 'Dynamic'.", - nullable=True, - enum={"Dynamic": "Dynamic", "Static": "Static"}, - ) - public_ip_address_update.public_ip_prefix = AAZObjectArg( - options=["public-ip-prefix"], - help="The Public IP Prefix this Public IP Address should be allocated from.", - nullable=True, - ) - cls._build_args_sub_resource_update(public_ip_address_update.public_ip_prefix) - public_ip_address_update.resource_guid = AAZStrArg( - options=["resource-guid"], - help="The resource GUID property of the public IP resource.", - nullable=True, - ) - public_ip_address_update.sku = AAZObjectArg( - options=["sku"], - help="The public IP address SKU.", - nullable=True, - ) - public_ip_address_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - public_ip_address_update.zones = AAZListArg( - options=["zones"], - help="A list of availability zones denoting the IP allocated for the resource needs to come from.", - nullable=True, - ) - - ddos_settings = cls._args_public_ip_address_update.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectArg( - options=["ddos-custom-policy"], - help="The DDoS custom policy associated with the public IP.", - nullable=True, - ) - cls._build_args_sub_resource_update(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrArg( - options=["protection-coverage"], - help="The DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized.", - nullable=True, - enum={"Basic": "Basic", "Standard": "Standard"}, - ) - - dns_settings = cls._args_public_ip_address_update.dns_settings - dns_settings.domain_name_label = AAZStrArg( - options=["domain-name-label"], - help="Gets or sets the Domain name label.The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system.", - nullable=True, - ) - dns_settings.fqdn = AAZStrArg( - options=["fqdn"], - help="Gets the FQDN, Fully qualified domain name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone.", - nullable=True, - ) - dns_settings.reverse_fqdn = AAZStrArg( - options=["reverse-fqdn"], - help="Gets or Sets the Reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. ", - nullable=True, - ) - - ip_tags = cls._args_public_ip_address_update.ip_tags - ip_tags.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_public_ip_address_update.ip_tags.Element - _element.ip_tag_type = AAZStrArg( - options=["ip-tag-type"], - help="Gets or sets the ipTag type: Example FirstPartyUsage.", - nullable=True, - ) - _element.tag = AAZStrArg( - options=["tag"], - help="Gets or sets value of the IpTag associated with the public IP. Example SQL, Storage etc", - nullable=True, - ) - - sku = cls._args_public_ip_address_update.sku - sku.name = AAZStrArg( - options=["name"], - help="Name of a public IP address SKU.", - nullable=True, - enum={"Basic": "Basic", "Standard": "Standard"}, - ) - - tags = cls._args_public_ip_address_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - zones = cls._args_public_ip_address_update.zones - zones.Element = AAZStrArg( - nullable=True, - ) - - _schema.ddos_settings = cls._args_public_ip_address_update.ddos_settings - _schema.dns_settings = cls._args_public_ip_address_update.dns_settings - _schema.etag = cls._args_public_ip_address_update.etag - _schema.id = cls._args_public_ip_address_update.id - _schema.idle_timeout_in_minutes = cls._args_public_ip_address_update.idle_timeout_in_minutes - _schema.ip_address = cls._args_public_ip_address_update.ip_address - _schema.ip_tags = cls._args_public_ip_address_update.ip_tags - _schema.location = cls._args_public_ip_address_update.location - _schema.provisioning_state = cls._args_public_ip_address_update.provisioning_state - _schema.public_ip_address_version = cls._args_public_ip_address_update.public_ip_address_version - _schema.public_ip_allocation_method = cls._args_public_ip_address_update.public_ip_allocation_method - _schema.public_ip_prefix = cls._args_public_ip_address_update.public_ip_prefix - _schema.resource_guid = cls._args_public_ip_address_update.resource_guid - _schema.sku = cls._args_public_ip_address_update.sku - _schema.tags = cls._args_public_ip_address_update.tags - _schema.zones = cls._args_public_ip_address_update.zones - - _args_security_rule_update = None - - @classmethod - def _build_args_security_rule_update(cls, _schema): - if cls._args_security_rule_update is not None: - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - return - - cls._args_security_rule_update = AAZObjectArg( - nullable=True, - ) - - security_rule_update = cls._args_security_rule_update - security_rule_update.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - security_rule_update.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - security_rule_update.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_update.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - security_rule_update.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - security_rule_update.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - security_rule_update.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - security_rule_update.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - security_rule_update.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_update.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - security_rule_update.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - security_rule_update.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - security_rule_update.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - security_rule_update.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - security_rule_update.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_update.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.etag = cls._args_security_rule_update.etag - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - - _args_sub_resource_update = None - - @classmethod - def _build_args_sub_resource_update(cls, _schema): - if cls._args_sub_resource_update is not None: - _schema.id = cls._args_sub_resource_update.id - return - - cls._args_sub_resource_update = AAZObjectArg( - nullable=True, - ) - - sub_resource_update = cls._args_sub_resource_update - sub_resource_update.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - - _schema.id = cls._args_sub_resource_update.id - - _args_subnet_update = None - - @classmethod - def _build_args_subnet_update(cls, _schema): - if cls._args_subnet_update is not None: - _schema.address_prefix = cls._args_subnet_update.address_prefix - _schema.address_prefixes = cls._args_subnet_update.address_prefixes - _schema.delegations = cls._args_subnet_update.delegations - _schema.id = cls._args_subnet_update.id - _schema.name = cls._args_subnet_update.name - _schema.network_security_group = cls._args_subnet_update.network_security_group - _schema.resource_navigation_links = cls._args_subnet_update.resource_navigation_links - _schema.route_table = cls._args_subnet_update.route_table - _schema.service_association_links = cls._args_subnet_update.service_association_links - _schema.service_endpoint_policies = cls._args_subnet_update.service_endpoint_policies - _schema.service_endpoints = cls._args_subnet_update.service_endpoints - return - - cls._args_subnet_update = AAZObjectArg( - nullable=True, - ) - - subnet_update = cls._args_subnet_update - subnet_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworks/{}/subnets/{}", - ), - ) - subnet_update.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - subnet_update.address_prefix = AAZStrArg( - options=["address-prefix"], - help="The address prefix for the subnet.", - nullable=True, - ) - subnet_update.address_prefixes = AAZListArg( - options=["address-prefixes"], - help="List of address prefixes for the subnet.", - nullable=True, - ) - subnet_update.delegations = AAZListArg( - options=["delegations"], - help="Gets an array of references to the delegations on the subnet.", - nullable=True, - ) - subnet_update.network_security_group = AAZObjectArg( - options=["network-security-group"], - help="The reference of the NetworkSecurityGroup resource.", - nullable=True, - ) - cls._build_args_network_security_group_update(subnet_update.network_security_group) - subnet_update.resource_navigation_links = AAZListArg( - options=["resource-navigation-links"], - help="Gets an array of references to the external resources using subnet.", - nullable=True, - ) - subnet_update.route_table = AAZObjectArg( - options=["route-table"], - help="The reference of the RouteTable resource.", - nullable=True, - ) - subnet_update.service_association_links = AAZListArg( - options=["service-association-links"], - help="Gets an array of references to services injecting into this subnet.", - nullable=True, - ) - subnet_update.service_endpoint_policies = AAZListArg( - options=["service-endpoint-policies"], - help="An array of service endpoint policies.", - nullable=True, - ) - subnet_update.service_endpoints = AAZListArg( - options=["service-endpoints"], - help="An array of service endpoints.", - nullable=True, - ) - - address_prefixes = cls._args_subnet_update.address_prefixes - address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - delegations = cls._args_subnet_update.delegations - delegations.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_subnet_update.delegations.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a subnet. This name can be used to access the resource.", - nullable=True, - ) - _element.actions = AAZListArg( - options=["actions"], - help="Describes the actions permitted to the service upon delegation", - nullable=True, - ) - _element.service_name = AAZStrArg( - options=["service-name"], - help="The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers)", - nullable=True, - ) - - actions = cls._args_subnet_update.delegations.Element.actions - actions.Element = AAZStrArg( - nullable=True, - ) - - resource_navigation_links = cls._args_subnet_update.resource_navigation_links - resource_navigation_links.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_subnet_update.resource_navigation_links.Element - _element.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="Name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.link = AAZStrArg( - options=["link"], - help="Link to the external resource", - nullable=True, - ) - _element.linked_resource_type = AAZStrArg( - options=["linked-resource-type"], - help="Resource type of the linked resource.", - nullable=True, - ) - - route_table = cls._args_subnet_update.route_table - route_table.etag = AAZStrArg( - options=["etag"], - help="Gets a unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - route_table.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", - ), - ) - route_table.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - route_table.disable_bgp_route_propagation = AAZBoolArg( - options=["disable-bgp-route-propagation"], - help="Gets or sets whether to disable the routes learned by BGP on that route table. True means disable.", - nullable=True, - ) - route_table.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - route_table.routes = AAZListArg( - options=["routes"], - help="Collection of routes contained within a route table.", - nullable=True, - ) - route_table.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - routes = cls._args_subnet_update.route_table.routes - routes.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_subnet_update.route_table.routes.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}/routes/{}", - ), - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.address_prefix = AAZStrArg( - options=["address-prefix"], - help="The destination CIDR to which the route applies.", - nullable=True, - ) - _element.next_hop_ip_address = AAZStrArg( - options=["next-hop-ip-address"], - help="The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.", - nullable=True, - ) - _element.next_hop_type = AAZStrArg( - options=["next-hop-type"], - help="The type of Azure hop the packet should be sent to. Possible values are: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'", - enum={"Internet": "Internet", "None": "None", "VirtualAppliance": "VirtualAppliance", "VirtualNetworkGateway": "VirtualNetworkGateway", "VnetLocal": "VnetLocal"}, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - - tags = cls._args_subnet_update.route_table.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - service_association_links = cls._args_subnet_update.service_association_links - service_association_links.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_subnet_update.service_association_links.Element - _element.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="Name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.link = AAZStrArg( - options=["link"], - help="Link to the external resource.", - nullable=True, - ) - _element.linked_resource_type = AAZStrArg( - options=["linked-resource-type"], - help="Resource type of the linked resource.", - nullable=True, - ) - - service_endpoint_policies = cls._args_subnet_update.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_subnet_update.service_endpoint_policies.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}", - ), - ) - _element.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _element.service_endpoint_policy_definitions = AAZListArg( - options=["service-endpoint-policy-definitions"], - help="A collection of service endpoint policy definitions of the service endpoint policy.", - nullable=True, - ) - _element.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - service_endpoint_policy_definitions = cls._args_subnet_update.service_endpoint_policies.Element.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_subnet_update.service_endpoint_policies.Element.service_endpoint_policy_definitions.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}", - ), - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - _element.service = AAZStrArg( - options=["service"], - help="service endpoint name.", - nullable=True, - ) - _element.service_resources = AAZListArg( - options=["service-resources"], - help="A list of service resources.", - nullable=True, - ) - - service_resources = cls._args_subnet_update.service_endpoint_policies.Element.service_endpoint_policy_definitions.Element.service_resources - service_resources.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_subnet_update.service_endpoint_policies.Element.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - service_endpoints = cls._args_subnet_update.service_endpoints - service_endpoints.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_subnet_update.service_endpoints.Element - _element.locations = AAZListArg( - options=["locations"], - help="A list of locations.", - nullable=True, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource.", - nullable=True, - ) - _element.service = AAZStrArg( - options=["service"], - help="The type of the endpoint service.", - nullable=True, - ) - - locations = cls._args_subnet_update.service_endpoints.Element.locations - locations.Element = AAZStrArg( - nullable=True, - ) - - _schema.address_prefix = cls._args_subnet_update.address_prefix - _schema.address_prefixes = cls._args_subnet_update.address_prefixes - _schema.delegations = cls._args_subnet_update.delegations - _schema.id = cls._args_subnet_update.id - _schema.name = cls._args_subnet_update.name - _schema.network_security_group = cls._args_subnet_update.network_security_group - _schema.resource_navigation_links = cls._args_subnet_update.resource_navigation_links - _schema.route_table = cls._args_subnet_update.route_table - _schema.service_association_links = cls._args_subnet_update.service_association_links - _schema.service_endpoint_policies = cls._args_subnet_update.service_endpoint_policies - _schema.service_endpoints = cls._args_subnet_update.service_endpoints - - _args_virtual_network_tap_update = None - - @classmethod - def _build_args_virtual_network_tap_update(cls, _schema): - if cls._args_virtual_network_tap_update is not None: - _schema.destination_load_balancer_front_end_ip_configuration = cls._args_virtual_network_tap_update.destination_load_balancer_front_end_ip_configuration - _schema.destination_network_interface_ip_configuration = cls._args_virtual_network_tap_update.destination_network_interface_ip_configuration - _schema.destination_port = cls._args_virtual_network_tap_update.destination_port - _schema.etag = cls._args_virtual_network_tap_update.etag - _schema.id = cls._args_virtual_network_tap_update.id - _schema.location = cls._args_virtual_network_tap_update.location - _schema.tags = cls._args_virtual_network_tap_update.tags - return - - cls._args_virtual_network_tap_update = AAZObjectArg( - nullable=True, - ) - - virtual_network_tap_update = cls._args_virtual_network_tap_update - virtual_network_tap_update.etag = AAZStrArg( - options=["etag"], - help="Gets a unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - virtual_network_tap_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/virtualNetworkTaps/{}", - ), - ) - virtual_network_tap_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - virtual_network_tap_update.destination_load_balancer_front_end_ip_configuration = AAZObjectArg( - options=["destination-load-balancer-front-end-ip-configuration"], - help="The reference to the private IP address on the internal Load Balancer that will receive the tap", - nullable=True, - ) - virtual_network_tap_update.destination_network_interface_ip_configuration = AAZObjectArg( - options=["destination-network-interface-ip-configuration"], - help="The reference to the private IP Address of the collector nic that will receive the tap", - nullable=True, - ) - cls._build_args_network_interface_ip_configuration_update(virtual_network_tap_update.destination_network_interface_ip_configuration) - virtual_network_tap_update.destination_port = AAZIntArg( - options=["destination-port"], - help="The VXLAN destination port that will receive the tapped traffic.", - nullable=True, - ) - virtual_network_tap_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - destination_load_balancer_front_end_ip_configuration = cls._args_virtual_network_tap_update.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - destination_load_balancer_front_end_ip_configuration.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/loadBalancers/{}/frontendIPConfigurations/{}", - ), - ) - destination_load_balancer_front_end_ip_configuration.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - destination_load_balancer_front_end_ip_configuration.private_ip_address = AAZStrArg( - options=["private-ip-address"], - help="The private IP address of the IP configuration.", - nullable=True, - ) - destination_load_balancer_front_end_ip_configuration.private_ip_allocation_method = AAZStrArg( - options=["private-ip-allocation-method"], - help="The Private IP allocation method. Possible values are: 'Static' and 'Dynamic'.", - nullable=True, - enum={"Dynamic": "Dynamic", "Static": "Static"}, - ) - destination_load_balancer_front_end_ip_configuration.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="Gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - destination_load_balancer_front_end_ip_configuration.public_ip_address = AAZObjectArg( - options=["public-ip-address"], - help="The reference of the Public IP resource.", - nullable=True, - ) - cls._build_args_public_ip_address_update(destination_load_balancer_front_end_ip_configuration.public_ip_address) - destination_load_balancer_front_end_ip_configuration.public_ip_prefix = AAZObjectArg( - options=["public-ip-prefix"], - help="The reference of the Public IP Prefix resource.", - nullable=True, - ) - cls._build_args_sub_resource_update(destination_load_balancer_front_end_ip_configuration.public_ip_prefix) - destination_load_balancer_front_end_ip_configuration.subnet = AAZObjectArg( - options=["subnet"], - help="The reference of the subnet resource.", - nullable=True, - ) - cls._build_args_subnet_update(destination_load_balancer_front_end_ip_configuration.subnet) - destination_load_balancer_front_end_ip_configuration.zones = AAZListArg( - options=["zones"], - help="A list of availability zones denoting the IP allocated for the resource needs to come from.", - nullable=True, - ) - - zones = cls._args_virtual_network_tap_update.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_virtual_network_tap_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.destination_load_balancer_front_end_ip_configuration = cls._args_virtual_network_tap_update.destination_load_balancer_front_end_ip_configuration - _schema.destination_network_interface_ip_configuration = cls._args_virtual_network_tap_update.destination_network_interface_ip_configuration - _schema.destination_port = cls._args_virtual_network_tap_update.destination_port - _schema.etag = cls._args_virtual_network_tap_update.etag - _schema.id = cls._args_virtual_network_tap_update.id - _schema.location = cls._args_virtual_network_tap_update.location - _schema.tags = cls._args_virtual_network_tap_update.tags - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.NetworkInterfacesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class NetworkInterfacesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - class NetworkInterfacesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2018-11-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_network_interface_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("dnsSettings", AAZObjectType) - properties.set_prop("enableAcceleratedNetworking", AAZBoolType, ".accelerated_networking") - properties.set_prop("enableIPForwarding", AAZBoolType, ".ip_forwarding") - properties.set_prop("networkSecurityGroup", AAZObjectType, ".nsg") - properties.set_prop("tapConfigurations", AAZListType, ".tap_configurations") - - dns_settings = _builder.get(".properties.dnsSettings") - if dns_settings is not None: - dns_settings.set_prop("dnsServers", AAZListType, ".dns_servers") - dns_settings.set_prop("internalDnsNameLabel", AAZStrType, ".internal_dns_name") - - dns_servers = _builder.get(".properties.dnsSettings.dnsServers") - if dns_servers is not None: - dns_servers.set_elements(AAZStrType, ".") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("id", AAZStrType, ".id") - network_security_group.set_prop("location", AAZStrType, ".location") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - network_security_group.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties.networkSecurityGroup.properties") - if properties is not None: - properties.set_prop("securityRules", AAZListType, ".security_rules") - - security_rules = _builder.get(".properties.networkSecurityGroup.properties.securityRules") - if security_rules is not None: - security_rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.networkSecurityGroup.properties.securityRules[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - _UpdateHelper._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - _UpdateHelper._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.networkSecurityGroup.properties.securityRules[].properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - tags = _builder.get(".properties.networkSecurityGroup.tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - tap_configurations = _builder.get(".properties.tapConfigurations") - if tap_configurations is not None: - tap_configurations.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.tapConfigurations[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.tapConfigurations[].properties") - if properties is not None: - _UpdateHelper._build_schema_virtual_network_tap_update(properties.set_prop("virtualNetworkTap", AAZObjectType, ".virtual_network_tap")) - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_application_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_network_interface_ip_configuration_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("applicationGatewayBackendAddressPools", AAZListType, ".application_gateway_backend_address_pools") - properties.set_prop("applicationSecurityGroups", AAZListType, ".application_security_groups") - properties.set_prop("loadBalancerBackendAddressPools", AAZListType, ".load_balancer_backend_address_pools") - properties.set_prop("loadBalancerInboundNatRules", AAZListType, ".load_balancer_inbound_nat_rules") - properties.set_prop("primary", AAZBoolType, ".primary") - properties.set_prop("privateIPAddress", AAZStrType, ".private_ip_address") - properties.set_prop("privateIPAddressVersion", AAZStrType, ".private_ip_address_version") - properties.set_prop("privateIPAllocationMethod", AAZStrType, ".private_ip_allocation_method") - cls._build_schema_public_ip_address_update(properties.set_prop("publicIPAddress", AAZObjectType, ".public_ip_address")) - cls._build_schema_subnet_update(properties.set_prop("subnet", AAZObjectType, ".subnet")) - properties.set_prop("virtualNetworkTaps", AAZListType, ".virtual_network_taps") - - application_gateway_backend_address_pools = _builder.get(".properties.applicationGatewayBackendAddressPools") - if application_gateway_backend_address_pools is not None: - application_gateway_backend_address_pools.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.applicationGatewayBackendAddressPools[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _elements.set_prop("type", AAZStrType, ".type") - - properties = _builder.get(".properties.applicationGatewayBackendAddressPools[].properties") - if properties is not None: - properties.set_prop("backendAddresses", AAZListType, ".backend_addresses") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - - backend_addresses = _builder.get(".properties.applicationGatewayBackendAddressPools[].properties.backendAddresses") - if backend_addresses is not None: - backend_addresses.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.applicationGatewayBackendAddressPools[].properties.backendAddresses[]") - if _elements is not None: - _elements.set_prop("fqdn", AAZStrType, ".fqdn") - _elements.set_prop("ipAddress", AAZStrType, ".ip_address") - - application_security_groups = _builder.get(".properties.applicationSecurityGroups") - if application_security_groups is not None: - cls._build_schema_application_security_group_update(application_security_groups.set_elements(AAZObjectType, ".")) - - load_balancer_backend_address_pools = _builder.get(".properties.loadBalancerBackendAddressPools") - if load_balancer_backend_address_pools is not None: - load_balancer_backend_address_pools.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.loadBalancerBackendAddressPools[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.loadBalancerBackendAddressPools[].properties") - if properties is not None: - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - - load_balancer_inbound_nat_rules = _builder.get(".properties.loadBalancerInboundNatRules") - if load_balancer_inbound_nat_rules is not None: - load_balancer_inbound_nat_rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.loadBalancerInboundNatRules[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.loadBalancerInboundNatRules[].properties") - if properties is not None: - properties.set_prop("backendPort", AAZIntType, ".backend_port") - properties.set_prop("enableFloatingIP", AAZBoolType, ".enable_floating_ip") - properties.set_prop("enableTcpReset", AAZBoolType, ".enable_tcp_reset") - cls._build_schema_sub_resource_update(properties.set_prop("frontendIPConfiguration", AAZObjectType, ".frontend_ip_configuration")) - properties.set_prop("frontendPort", AAZIntType, ".frontend_port") - properties.set_prop("idleTimeoutInMinutes", AAZIntType, ".idle_timeout_in_minutes") - properties.set_prop("protocol", AAZStrType, ".protocol") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - - virtual_network_taps = _builder.get(".properties.virtualNetworkTaps") - if virtual_network_taps is not None: - virtual_network_taps.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.virtualNetworkTaps[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("location", AAZStrType, ".location") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _elements.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties.virtualNetworkTaps[].properties") - if properties is not None: - properties.set_prop("destinationLoadBalancerFrontEndIPConfiguration", AAZObjectType, ".destination_load_balancer_front_end_ip_configuration") - cls._build_schema_network_interface_ip_configuration_update(properties.set_prop("destinationNetworkInterfaceIPConfiguration", AAZObjectType, ".destination_network_interface_ip_configuration")) - properties.set_prop("destinationPort", AAZIntType, ".destination_port") - - destination_load_balancer_front_end_ip_configuration = _builder.get(".properties.virtualNetworkTaps[].properties.destinationLoadBalancerFrontEndIPConfiguration") - if destination_load_balancer_front_end_ip_configuration is not None: - destination_load_balancer_front_end_ip_configuration.set_prop("etag", AAZStrType, ".etag") - destination_load_balancer_front_end_ip_configuration.set_prop("id", AAZStrType, ".id") - destination_load_balancer_front_end_ip_configuration.set_prop("name", AAZStrType, ".name") - destination_load_balancer_front_end_ip_configuration.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - destination_load_balancer_front_end_ip_configuration.set_prop("zones", AAZListType, ".zones") - - properties = _builder.get(".properties.virtualNetworkTaps[].properties.destinationLoadBalancerFrontEndIPConfiguration.properties") - if properties is not None: - properties.set_prop("privateIPAddress", AAZStrType, ".private_ip_address") - properties.set_prop("privateIPAllocationMethod", AAZStrType, ".private_ip_allocation_method") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - cls._build_schema_public_ip_address_update(properties.set_prop("publicIPAddress", AAZObjectType, ".public_ip_address")) - cls._build_schema_sub_resource_update(properties.set_prop("publicIPPrefix", AAZObjectType, ".public_ip_prefix")) - cls._build_schema_subnet_update(properties.set_prop("subnet", AAZObjectType, ".subnet")) - - zones = _builder.get(".properties.virtualNetworkTaps[].properties.destinationLoadBalancerFrontEndIPConfiguration.zones") - if zones is not None: - zones.set_elements(AAZStrType, ".") - - tags = _builder.get(".properties.virtualNetworkTaps[].tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_network_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("defaultSecurityRules", AAZListType, ".default_security_rules") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("resourceGuid", AAZStrType, ".resource_guid") - properties.set_prop("securityRules", AAZListType, ".security_rules") - - default_security_rules = _builder.get(".properties.defaultSecurityRules") - if default_security_rules is not None: - cls._build_schema_security_rule_update(default_security_rules.set_elements(AAZObjectType, ".")) - - security_rules = _builder.get(".properties.securityRules") - if security_rules is not None: - security_rules.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.securityRules[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.securityRules[].properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.securityRules[].properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.securityRules[].properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.securityRules[].properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.securityRules[].properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.securityRules[].properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.securityRules[].properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_public_ip_address_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - _builder.set_prop("tags", AAZDictType, ".tags") - _builder.set_prop("zones", AAZListType, ".zones") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("ddosSettings", AAZObjectType, ".ddos_settings") - properties.set_prop("dnsSettings", AAZObjectType, ".dns_settings") - properties.set_prop("idleTimeoutInMinutes", AAZIntType, ".idle_timeout_in_minutes") - properties.set_prop("ipAddress", AAZStrType, ".ip_address") - properties.set_prop("ipTags", AAZListType, ".ip_tags") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("publicIPAddressVersion", AAZStrType, ".public_ip_address_version") - properties.set_prop("publicIPAllocationMethod", AAZStrType, ".public_ip_allocation_method") - cls._build_schema_sub_resource_update(properties.set_prop("publicIPPrefix", AAZObjectType, ".public_ip_prefix")) - properties.set_prop("resourceGuid", AAZStrType, ".resource_guid") - - ddos_settings = _builder.get(".properties.ddosSettings") - if ddos_settings is not None: - cls._build_schema_sub_resource_update(ddos_settings.set_prop("ddosCustomPolicy", AAZObjectType, ".ddos_custom_policy")) - ddos_settings.set_prop("protectionCoverage", AAZStrType, ".protection_coverage") - - dns_settings = _builder.get(".properties.dnsSettings") - if dns_settings is not None: - dns_settings.set_prop("domainNameLabel", AAZStrType, ".domain_name_label") - dns_settings.set_prop("fqdn", AAZStrType, ".fqdn") - dns_settings.set_prop("reverseFqdn", AAZStrType, ".reverse_fqdn") - - ip_tags = _builder.get(".properties.ipTags") - if ip_tags is not None: - ip_tags.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.ipTags[]") - if _elements is not None: - _elements.set_prop("ipTagType", AAZStrType, ".ip_tag_type") - _elements.set_prop("tag", AAZStrType, ".tag") - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".name") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - zones = _builder.get(".zones") - if zones is not None: - zones.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_sub_resource_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - @classmethod - def _build_schema_subnet_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefix", AAZStrType, ".address_prefix") - properties.set_prop("addressPrefixes", AAZListType, ".address_prefixes") - properties.set_prop("delegations", AAZListType, ".delegations") - cls._build_schema_network_security_group_update(properties.set_prop("networkSecurityGroup", AAZObjectType, ".network_security_group")) - properties.set_prop("resourceNavigationLinks", AAZListType, ".resource_navigation_links") - properties.set_prop("routeTable", AAZObjectType, ".route_table") - properties.set_prop("serviceAssociationLinks", AAZListType, ".service_association_links") - properties.set_prop("serviceEndpointPolicies", AAZListType, ".service_endpoint_policies") - properties.set_prop("serviceEndpoints", AAZListType, ".service_endpoints") - - address_prefixes = _builder.get(".properties.addressPrefixes") - if address_prefixes is not None: - address_prefixes.set_elements(AAZStrType, ".") - - delegations = _builder.get(".properties.delegations") - if delegations is not None: - delegations.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.delegations[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.delegations[].properties") - if properties is not None: - properties.set_prop("actions", AAZListType, ".actions") - properties.set_prop("serviceName", AAZStrType, ".service_name") - - actions = _builder.get(".properties.delegations[].properties.actions") - if actions is not None: - actions.set_elements(AAZStrType, ".") - - resource_navigation_links = _builder.get(".properties.resourceNavigationLinks") - if resource_navigation_links is not None: - resource_navigation_links.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.resourceNavigationLinks[]") - if _elements is not None: - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.resourceNavigationLinks[].properties") - if properties is not None: - properties.set_prop("link", AAZStrType, ".link") - properties.set_prop("linkedResourceType", AAZStrType, ".linked_resource_type") - - route_table = _builder.get(".properties.routeTable") - if route_table is not None: - route_table.set_prop("etag", AAZStrType, ".etag") - route_table.set_prop("id", AAZStrType, ".id") - route_table.set_prop("location", AAZStrType, ".location") - route_table.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - route_table.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties.routeTable.properties") - if properties is not None: - properties.set_prop("disableBgpRoutePropagation", AAZBoolType, ".disable_bgp_route_propagation") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("routes", AAZListType, ".routes") - - routes = _builder.get(".properties.routeTable.properties.routes") - if routes is not None: - routes.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.routeTable.properties.routes[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.routeTable.properties.routes[].properties") - if properties is not None: - properties.set_prop("addressPrefix", AAZStrType, ".address_prefix") - properties.set_prop("nextHopIpAddress", AAZStrType, ".next_hop_ip_address") - properties.set_prop("nextHopType", AAZStrType, ".next_hop_type", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - - tags = _builder.get(".properties.routeTable.tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - service_association_links = _builder.get(".properties.serviceAssociationLinks") - if service_association_links is not None: - service_association_links.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceAssociationLinks[]") - if _elements is not None: - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.serviceAssociationLinks[].properties") - if properties is not None: - properties.set_prop("link", AAZStrType, ".link") - properties.set_prop("linkedResourceType", AAZStrType, ".linked_resource_type") - - service_endpoint_policies = _builder.get(".properties.serviceEndpointPolicies") - if service_endpoint_policies is not None: - service_endpoint_policies.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpointPolicies[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("location", AAZStrType, ".location") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _elements.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties.serviceEndpointPolicies[].properties") - if properties is not None: - properties.set_prop("serviceEndpointPolicyDefinitions", AAZListType, ".service_endpoint_policy_definitions") - - service_endpoint_policy_definitions = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions") - if service_endpoint_policy_definitions is not None: - service_endpoint_policy_definitions.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[].properties") - if properties is not None: - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("service", AAZStrType, ".service") - properties.set_prop("serviceResources", AAZListType, ".service_resources") - - service_resources = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[].properties.serviceResources") - if service_resources is not None: - service_resources.set_elements(AAZStrType, ".") - - tags = _builder.get(".properties.serviceEndpointPolicies[].tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - service_endpoints = _builder.get(".properties.serviceEndpoints") - if service_endpoints is not None: - service_endpoints.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpoints[]") - if _elements is not None: - _elements.set_prop("locations", AAZListType, ".locations") - _elements.set_prop("provisioningState", AAZStrType, ".provisioning_state") - _elements.set_prop("service", AAZStrType, ".service") - - locations = _builder.get(".properties.serviceEndpoints[].locations") - if locations is not None: - locations.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_virtual_network_tap_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("destinationLoadBalancerFrontEndIPConfiguration", AAZObjectType, ".destination_load_balancer_front_end_ip_configuration") - cls._build_schema_network_interface_ip_configuration_update(properties.set_prop("destinationNetworkInterfaceIPConfiguration", AAZObjectType, ".destination_network_interface_ip_configuration")) - properties.set_prop("destinationPort", AAZIntType, ".destination_port") - - destination_load_balancer_front_end_ip_configuration = _builder.get(".properties.destinationLoadBalancerFrontEndIPConfiguration") - if destination_load_balancer_front_end_ip_configuration is not None: - destination_load_balancer_front_end_ip_configuration.set_prop("etag", AAZStrType, ".etag") - destination_load_balancer_front_end_ip_configuration.set_prop("id", AAZStrType, ".id") - destination_load_balancer_front_end_ip_configuration.set_prop("name", AAZStrType, ".name") - destination_load_balancer_front_end_ip_configuration.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - destination_load_balancer_front_end_ip_configuration.set_prop("zones", AAZListType, ".zones") - - properties = _builder.get(".properties.destinationLoadBalancerFrontEndIPConfiguration.properties") - if properties is not None: - properties.set_prop("privateIPAddress", AAZStrType, ".private_ip_address") - properties.set_prop("privateIPAllocationMethod", AAZStrType, ".private_ip_allocation_method") - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - cls._build_schema_public_ip_address_update(properties.set_prop("publicIPAddress", AAZObjectType, ".public_ip_address")) - cls._build_schema_sub_resource_update(properties.set_prop("publicIPPrefix", AAZObjectType, ".public_ip_prefix")) - cls._build_schema_subnet_update(properties.set_prop("subnet", AAZObjectType, ".subnet")) - - zones = _builder.get(".properties.destinationLoadBalancerFrontEndIPConfiguration.zones") - if zones is not None: - zones.set_elements(AAZStrType, ".") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/__cmd_group.py deleted file mode 100644 index 22ad607bc90..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage Azure Network Security Groups (NSGs). - - You can control network traffic to resources in a virtual network using a network security group. A network security group contains a list of security rules that allow or deny inbound or outbound network traffic based on source or destination IP addresses, Application Security Groups, ports, and protocols. For more information visit https://learn.microsoft.com/azure/virtual-network/virtual-networks-create-nsg-arm-cli. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/__init__.py deleted file mode 100644 index 4fbda4a6e7a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/_create.py deleted file mode 100644 index 466741951ce..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/_create.py +++ /dev/null @@ -1,1726 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a network security group. - - :example: Create an NSG in a resource group within a region with tags. - az network nsg create -g MyResourceGroup -n MyNsg --tags foo=bar - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}", "2018-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - help="Space-separated tags: key[=value] [key[=value] ...].", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Parameters" - - # define Arg Group "Properties" - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - _args_security_rule_create = None - - @classmethod - def _build_args_security_rule_create(cls, _schema): - if cls._args_security_rule_create is not None: - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - return - - cls._args_security_rule_create = AAZObjectArg() - - security_rule_create = cls._args_security_rule_create - security_rule_create.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - ) - security_rule_create.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - ) - security_rule_create.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_create.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - ) - security_rule_create.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - security_rule_create.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - ) - security_rule_create.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - ) - security_rule_create.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - ) - security_rule_create.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_create.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - security_rule_create.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_create.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - ) - security_rule_create.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - ) - security_rule_create.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - ) - security_rule_create.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - ) - security_rule_create.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - ) - - destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_create.source_port_ranges - source_port_ranges.Element = AAZStrArg() - - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.etag = cls._args_security_rule_create.etag - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - yield self.NetworkSecurityGroupsCreateOrUpdate(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 NetworkSecurityGroupsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2018-11-01", - 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("location", AAZStrType, ".location") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_network_security_group_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("etag", AAZStrType, ".etag") - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/_show.py deleted file mode 100644 index 7bf24a22fc2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/_show.py +++ /dev/null @@ -1,1441 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get information about a network security group. - - :example: Get basic information about an NSG. - az network nsg show -g MyResourceGroup -n MyNsg - - :example: Get the default security rules of an NSG and format the output as a table. - az network nsg show -g MyResourceGroup -n MyNsg --query "defaultSecurityRules[]" -o table - - :example: Get all default NSG rules with "Allow" access and format the output as a table. - az network nsg show -g MyResourceGroup -n MyNsg --query "defaultSecurityRules[?access=='Allow']" -o table - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}", "2018-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkSecurityGroupsGet(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 NetworkSecurityGroupsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_security_group_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/__cmd_group.py deleted file mode 100644 index 6e93e97c0d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/__cmd_group.py +++ /dev/null @@ -1,20 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage network security group rules. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/__init__.py deleted file mode 100644 index a6df9f5a835..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/_create.py deleted file mode 100644 index b414889dd15..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/nsg/rule/_create.py +++ /dev/null @@ -1,541 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a network security group rule. - - :example: Create a basic "Allow" NSG rule with the highest priority. - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule --priority 100 - - :example: Create a "Deny" rule over TCP for a specific IP address range with the lowest priority. - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRule --priority 4096 --source-address-prefixes 208.130.28.0/24 --source-port-ranges 80 --destination-address-prefixes '*' --destination-port-ranges 80 8080 --access Deny --protocol Tcp --description "Deny from specific IP address ranges on 80 and 8080." - - :example: Create a security rule using service tags (https://aka.ms/servicetags). - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRuleWithTags --priority 400 --source-address-prefixes VirtualNetwork --destination-address-prefixes Storage --destination-port-ranges '*' --direction Outbound --access Allow --protocol Tcp --description "Allow VirtualNetwork to Storage." - - :example: Create a security rule using application security groups (https://aka.ms/applicationsecuritygroups). - az network nsg rule create -g MyResourceGroup --nsg-name MyNsg -n MyNsgRuleWithAsg --priority 500 --source-address-prefixes Internet --destination-port-ranges 80 8080 --destination-asgs Web --access Allow --protocol Tcp --description "Allow Internet to Web ASG on ports 80,8080." - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecuritygroups/{}/securityrules/{}", "2018-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.nsg_name = AAZStrArg( - options=["--nsg-name"], - help="Name of the network security group.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="Name of the network security group rule.", - required=True, - ) - _args_schema.access = AAZStrArg( - options=["--access"], - help="Network traffic is allowed or denied.", - default="Allow", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - _args_schema.description = AAZStrArg( - options=["--description"], - help="Description for this rule. Restricted to 140 chars.", - ) - _args_schema.direction = AAZStrArg( - options=["--direction"], - help="Direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic.", - default="Inbound", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _args_schema.priority = AAZIntArg( - options=["--priority"], - help="Priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - _args_schema.protocol = AAZStrArg( - options=["--protocol"], - help="Network protocol this rule applies to.", - default="*", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - - # define Arg Group "Destination" - - _args_schema = cls._args_schema - _args_schema.destination_address_prefix = AAZStrArg( - options=["--destination-address-prefix"], - arg_group="Destination", - help="The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - _args_schema.destination_address_prefixes = AAZListArg( - options=["--destination-address-prefixes"], - arg_group="Destination", - help="Space-separated list of CIDR prefixes or IP ranges. Alternatively, specify ONE of 'VirtualNetwork', 'AzureLoadBalancer', 'Internet' or '*' to match all IPs. Besides, it also supports all available Service Tags like 'ApiManagement', 'SqlManagement', 'AzureMonitor', etc.", - default=["*"], - ) - _args_schema.destination_application_security_groups = AAZListArg( - options=["--destination-application-security-groups"], - arg_group="Destination", - help="Application security group specified as destination.", - ) - _args_schema.destination_port_range = AAZStrArg( - options=["--destination-port-range"], - arg_group="Destination", - help="The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - ) - _args_schema.destination_port_ranges = AAZListArg( - options=["--destination-port-ranges"], - arg_group="Destination", - help="Space-separated list of ports or port ranges between 0-65535. Use '*' to match all ports.", - default=["80"], - ) - - destination_address_prefixes = cls._args_schema.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_schema.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_schema.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - # define Arg Group "Properties" - - # define Arg Group "SecurityRuleParameters" - - # define Arg Group "Source" - - _args_schema = cls._args_schema - _args_schema.source_address_prefix = AAZStrArg( - options=["--source-address-prefix"], - arg_group="Source", - help="The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from.", - ) - _args_schema.source_address_prefixes = AAZListArg( - options=["--source-address-prefixes"], - arg_group="Source", - help="Space-separated list of CIDR prefixes or IP ranges. Alternatively, specify ONE of 'VirtualNetwork', 'AzureLoadBalancer', 'Internet' or '*' to match all IPs. Besides, it also supports all available Service Tags like 'ApiManagement', 'SqlManagement', 'AzureMonitor', etc.", - default=["*"], - ) - _args_schema.source_application_security_groups = AAZListArg( - options=["--source-application-security-groups"], - arg_group="Source", - help="Application security group specified as source.", - ) - _args_schema.source_port_range = AAZStrArg( - options=["--source-port-range"], - arg_group="Source", - help="The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports.", - ) - _args_schema.source_port_ranges = AAZListArg( - options=["--source-port-ranges"], - arg_group="Source", - help="Space-separated list of ports or port ranges between 0-65535. Use '*' to match all ports.", - default=["*"], - ) - - source_address_prefixes = cls._args_schema.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_schema.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_schema.source_port_ranges - source_port_ranges.Element = AAZStrArg() - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - def _execute_operations(self): - self.pre_operations() - yield self.SecurityRulesCreateOrUpdate(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 SecurityRulesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityGroupName", self.ctx.args.nsg_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "securityRuleName", self.ctx.args.name, - required=True, - ), - **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", "2018-11-01", - 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") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - _CreateHelper._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - _CreateHelper._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.etag = AAZStrType() - _schema_on_200_201.id = AAZStrType() - _schema_on_200_201.name = AAZStrType() - _schema_on_200_201.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = cls._schema_on_200_201.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = cls._schema_on_200_201.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - _CreateHelper._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = cls._schema_on_200_201.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = cls._schema_on_200_201.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = cls._schema_on_200_201.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - _CreateHelper._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = cls._schema_on_200_201.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/__cmd_group.py deleted file mode 100644 index 2557faf7887..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage public IP addresses. - - To learn more about public IP addresses visit https://learn.microsoft.com/azure/virtual-network/virtual-network-public-ip-address. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/__init__.py deleted file mode 100644 index 2df85698253..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/_list.py deleted file mode 100644 index 5770f9604d3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/_list.py +++ /dev/null @@ -1,1521 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List public IP addresses. - - :example: List all public IPs in a subscription. - az network public-ip list - - :example: List all public IPs in a resource group. - az network public-ip list -g MyResourceGroup - - :example: List all public IPs of a domain name label. - az network public-ip list -g MyResourceGroup --query "[?dnsSettings.domainNameLabel=='MyLabel']" - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/publicipaddresses", "2018-11-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/publicipaddresses", "2018-11-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.PublicIPAddressesList(ctx=self.ctx)() - if condition_1: - self.PublicIPAddressesListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class PublicIPAddressesList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - class PublicIPAddressesListAll(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.Network/publicIPAddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/_show.py deleted file mode 100644 index d6dbe91f655..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/public_ip/_show.py +++ /dev/null @@ -1,1438 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get the details of a public IP address. - - :example: Get information about a public IP resource. - az network public-ip show -g MyResourceGroup -n MyIp - - :example: Get the FQDN and IP address of a public IP resource. - az network public-ip show -g MyResourceGroup -n MyIp --query "{fqdn: dnsSettings.fqdn,address: ipAddress}" - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/publicipaddresses/{}", "2018-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The name of the public IP address.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PublicIPAddressesGet(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 PublicIPAddressesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "publicIpAddressName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_public_ip_address_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/__cmd_group.py deleted file mode 100644 index 73d2004eb91..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Check if a private IP address is available for use within a virtual network. - - To learn more about Virtual Networks visit https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-network. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/__init__.py deleted file mode 100644 index d63ae5a6fc9..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/_list.py deleted file mode 100644 index aeb2ac82418..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/_list.py +++ /dev/null @@ -1,1733 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List virtual networks. - - :example: List all virtual networks in a subscription. - az network vnet list - - :example: List all virtual networks in a resource group. - az network vnet list -g MyResourceGroup - - :example: List virtual networks in a subscription which specify a certain address prefix. - az network vnet list --query "[?contains(addressSpace.addressPrefixes, '10.0.0.0/16')]" - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/virtualnetworks", "2018-11-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks", "2018-11-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.VirtualNetworksList(ctx=self.ctx)() - if condition_1: - self.VirtualNetworksListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualNetworksList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.address_space = AAZObjectType( - serialized_name="addressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.address_space) - properties.ddos_protection_plan = AAZObjectType( - serialized_name="ddosProtectionPlan", - ) - properties.dhcp_options = AAZObjectType( - serialized_name="dhcpOptions", - ) - properties.enable_ddos_protection = AAZBoolType( - serialized_name="enableDdosProtection", - ) - properties.enable_vm_protection = AAZBoolType( - serialized_name="enableVmProtection", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.subnets = AAZListType() - properties.virtual_network_peerings = AAZListType( - serialized_name="virtualNetworkPeerings", - ) - - ddos_protection_plan = cls._schema_on_200.value.Element.properties.ddos_protection_plan - ddos_protection_plan.id = AAZStrType() - - dhcp_options = cls._schema_on_200.value.Element.properties.dhcp_options - dhcp_options.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.dhcp_options.dns_servers - dns_servers.Element = AAZStrType() - - subnets = cls._schema_on_200.value.Element.properties.subnets - subnets.Element = AAZObjectType() - _ListHelper._build_schema_subnet_read(subnets.Element) - - virtual_network_peerings = cls._schema_on_200.value.Element.properties.virtual_network_peerings - virtual_network_peerings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element.properties - properties.allow_forwarded_traffic = AAZBoolType( - serialized_name="allowForwardedTraffic", - ) - properties.allow_gateway_transit = AAZBoolType( - serialized_name="allowGatewayTransit", - ) - properties.allow_virtual_network_access = AAZBoolType( - serialized_name="allowVirtualNetworkAccess", - ) - properties.peering_state = AAZStrType( - serialized_name="peeringState", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.remote_address_space = AAZObjectType( - serialized_name="remoteAddressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.remote_address_space) - properties.remote_virtual_network = AAZObjectType( - serialized_name="remoteVirtualNetwork", - ) - _ListHelper._build_schema_sub_resource_read(properties.remote_virtual_network) - properties.use_remote_gateways = AAZBoolType( - serialized_name="useRemoteGateways", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class VirtualNetworksListAll(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.Network/virtualNetworks", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.address_space = AAZObjectType( - serialized_name="addressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.address_space) - properties.ddos_protection_plan = AAZObjectType( - serialized_name="ddosProtectionPlan", - ) - properties.dhcp_options = AAZObjectType( - serialized_name="dhcpOptions", - ) - properties.enable_ddos_protection = AAZBoolType( - serialized_name="enableDdosProtection", - ) - properties.enable_vm_protection = AAZBoolType( - serialized_name="enableVmProtection", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.subnets = AAZListType() - properties.virtual_network_peerings = AAZListType( - serialized_name="virtualNetworkPeerings", - ) - - ddos_protection_plan = cls._schema_on_200.value.Element.properties.ddos_protection_plan - ddos_protection_plan.id = AAZStrType() - - dhcp_options = cls._schema_on_200.value.Element.properties.dhcp_options - dhcp_options.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.dhcp_options.dns_servers - dns_servers.Element = AAZStrType() - - subnets = cls._schema_on_200.value.Element.properties.subnets - subnets.Element = AAZObjectType() - _ListHelper._build_schema_subnet_read(subnets.Element) - - virtual_network_peerings = cls._schema_on_200.value.Element.properties.virtual_network_peerings - virtual_network_peerings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_network_peerings.Element.properties - properties.allow_forwarded_traffic = AAZBoolType( - serialized_name="allowForwardedTraffic", - ) - properties.allow_gateway_transit = AAZBoolType( - serialized_name="allowGatewayTransit", - ) - properties.allow_virtual_network_access = AAZBoolType( - serialized_name="allowVirtualNetworkAccess", - ) - properties.peering_state = AAZStrType( - serialized_name="peeringState", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.remote_address_space = AAZObjectType( - serialized_name="remoteAddressSpace", - ) - _ListHelper._build_schema_address_space_read(properties.remote_address_space) - properties.remote_virtual_network = AAZObjectType( - serialized_name="remoteVirtualNetwork", - ) - _ListHelper._build_schema_sub_resource_read(properties.remote_virtual_network) - properties.use_remote_gateways = AAZBoolType( - serialized_name="useRemoteGateways", - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_address_space_read = None - - @classmethod - def _build_schema_address_space_read(cls, _schema): - if cls._schema_address_space_read is not None: - _schema.address_prefixes = cls._schema_address_space_read.address_prefixes - return - - cls._schema_address_space_read = _schema_address_space_read = AAZObjectType() - - address_space_read = _schema_address_space_read - address_space_read.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - - address_prefixes = _schema_address_space_read.address_prefixes - address_prefixes.Element = AAZStrType() - - _schema.address_prefixes = cls._schema_address_space_read.address_prefixes - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/__cmd_group.py deleted file mode 100644 index 748734c3253..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/__cmd_group.py +++ /dev/null @@ -1,22 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class __CMDGroup(AAZCommandGroup): - """Manage subnets in an Azure Virtual Network. - - To learn more about subnets visit https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-subnet. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/__init__.py deleted file mode 100644 index 1fcc89bcaa3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_create.py deleted file mode 100644 index 80bf8aab3d3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_create.py +++ /dev/null @@ -1,1964 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a subnet and associate an existing NSG and route table. - - :example: Create new subnet attached to an NSG with a custom route table. - az network vnet subnet create -g MyResourceGroup --vnet-name MyVnet -n MySubnet --address-prefixes 10.0.0.0/24 --network-security-group MyNsg --route-table MyRouteTable - - :example: Create new subnet attached to a NAT gateway. - az network vnet subnet create -n MySubnet --vnet-name MyVnet -g MyResourceGroup --nat-gateway MyNatGateway --address-prefixes "10.0.0.0/21" - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2018-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - ) - _args_schema.address_prefix = AAZStrArg( - options=["--address-prefix"], - help="The address prefix for the subnet.", - ) - _args_schema.address_prefixes = AAZListArg( - options=["--address-prefixes"], - help="Space-separated list of address prefixes in CIDR format.", - ) - _args_schema.delegated_services = AAZListArg( - options=["--delegated-services"], - help="Space-separated list of services to whom the subnet should be delegated, e.g., `Microsoft.Sql/servers`.", - ) - _args_schema.network_security_group = AAZResourceIdArg( - options=["--nsg", "--network-security-group"], - help="Name or ID of a network security group (NSG).", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - _args_schema.route_table = AAZResourceIdArg( - options=["--route-table"], - help="Name or ID of a route table to associate with the subnet.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", - ), - ) - _args_schema.policies = AAZListArg( - options=["--policies"], - help="An array of service endpoint policies.", - ) - _args_schema.endpoints = AAZListArg( - options=["--endpoints"], - help="An array of service endpoints.", - ) - - address_prefixes = cls._args_schema.address_prefixes - address_prefixes.Element = AAZStrArg() - - delegated_services = cls._args_schema.delegated_services - delegated_services.Element = AAZObjectArg() - - _element = cls._args_schema.delegated_services.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - ) - _element.id = AAZStrArg( - options=["id"], - help="Resource ID.", - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a subnet. This name can be used to access the resource.", - ) - _element.actions = AAZListArg( - options=["actions"], - help="Describes the actions permitted to the service upon delegation", - ) - _element.service_name = AAZStrArg( - options=["service-name"], - help="The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers).", - ) - - actions = cls._args_schema.delegated_services.Element.actions - actions.Element = AAZStrArg() - - policies = cls._args_schema.policies - policies.Element = AAZObjectArg() - - _element = cls._args_schema.policies.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}", - ), - ) - _element.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _element.service_endpoint_policy_definitions = AAZListArg( - options=["service-endpoint-policy-definitions"], - help="A collection of service endpoint policy definitions of the service endpoint policy.", - ) - _element.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - service_endpoint_policy_definitions = cls._args_schema.policies.Element.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectArg() - - _element = cls._args_schema.policies.Element.service_endpoint_policy_definitions.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}", - ), - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - ) - _element.service = AAZStrArg( - options=["service"], - help="Service endpoint name.", - ) - _element.service_resources = AAZListArg( - options=["service-resources"], - help="A list of service resources.", - ) - - service_resources = cls._args_schema.policies.Element.service_endpoint_policy_definitions.Element.service_resources - service_resources.Element = AAZStrArg() - - tags = cls._args_schema.policies.Element.tags - tags.Element = AAZStrArg() - - endpoints = cls._args_schema.endpoints - endpoints.Element = AAZObjectArg() - - _element = cls._args_schema.endpoints.Element - _element.locations = AAZListArg( - options=["locations"], - help="A list of locations.", - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource.", - ) - _element.service = AAZStrArg( - options=["service"], - help="The type of the endpoint service.", - ) - - locations = cls._args_schema.endpoints.Element.locations - locations.Element = AAZStrArg() - - # define Arg Group "NetworkSecurityGroup" - - # define Arg Group "Properties" - - # define Arg Group "RouteTable" - - # define Arg Group "SubnetParameters" - return cls._args_schema - - _args_application_security_group_create = None - - @classmethod - def _build_args_application_security_group_create(cls, _schema): - if cls._args_application_security_group_create is not None: - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - return - - cls._args_application_security_group_create = AAZObjectArg() - - application_security_group_create = cls._args_application_security_group_create - application_security_group_create.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_create.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_create.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - ) - - tags = cls._args_application_security_group_create.tags - tags.Element = AAZStrArg() - - _schema.id = cls._args_application_security_group_create.id - _schema.location = cls._args_application_security_group_create.location - _schema.tags = cls._args_application_security_group_create.tags - - _args_security_rule_create = None - - @classmethod - def _build_args_security_rule_create(cls, _schema): - if cls._args_security_rule_create is not None: - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - return - - cls._args_security_rule_create = AAZObjectArg() - - security_rule_create = cls._args_security_rule_create - security_rule_create.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - ) - security_rule_create.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_create.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - ) - security_rule_create.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - ) - security_rule_create.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - ) - security_rule_create.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - ) - security_rule_create.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - ) - security_rule_create.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_create.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - ) - security_rule_create.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_create.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - ) - security_rule_create.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - ) - security_rule_create.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - ) - security_rule_create.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - ) - security_rule_create.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - ) - security_rule_create.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - ) - - destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg() - - destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - destination_port_ranges.Element = AAZStrArg() - - source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - source_address_prefixes.Element = AAZStrArg() - - source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg() - cls._build_args_application_security_group_create(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_create.source_port_ranges - source_port_ranges.Element = AAZStrArg() - - _schema.access = cls._args_security_rule_create.access - _schema.description = cls._args_security_rule_create.description - _schema.destination_address_prefix = cls._args_security_rule_create.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_create.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_create.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_create.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_create.destination_port_ranges - _schema.direction = cls._args_security_rule_create.direction - _schema.name = cls._args_security_rule_create.name - _schema.priority = cls._args_security_rule_create.priority - _schema.protocol = cls._args_security_rule_create.protocol - _schema.provisioning_state = cls._args_security_rule_create.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_create.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_create.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_create.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_create.source_port_range - _schema.source_port_ranges = cls._args_security_rule_create.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - yield self.SubnetsCreateOrUpdate(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 SubnetsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2018-11-01", - 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") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefix", AAZStrType, ".address_prefix") - properties.set_prop("addressPrefixes", AAZListType, ".address_prefixes") - properties.set_prop("delegations", AAZListType, ".delegated_services") - properties.set_prop("networkSecurityGroup", AAZObjectType) - properties.set_prop("routeTable", AAZObjectType) - properties.set_prop("serviceEndpointPolicies", AAZListType, ".policies") - properties.set_prop("serviceEndpoints", AAZListType, ".endpoints") - - address_prefixes = _builder.get(".properties.addressPrefixes") - if address_prefixes is not None: - address_prefixes.set_elements(AAZStrType, ".") - - delegations = _builder.get(".properties.delegations") - if delegations is not None: - delegations.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.delegations[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.delegations[].properties") - if properties is not None: - properties.set_prop("actions", AAZListType, ".actions") - properties.set_prop("serviceName", AAZStrType, ".service_name") - - actions = _builder.get(".properties.delegations[].properties.actions") - if actions is not None: - actions.set_elements(AAZStrType, ".") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("id", AAZStrType, ".network_security_group") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - route_table = _builder.get(".properties.routeTable") - if route_table is not None: - route_table.set_prop("id", AAZStrType, ".route_table") - route_table.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - service_endpoint_policies = _builder.get(".properties.serviceEndpointPolicies") - if service_endpoint_policies is not None: - service_endpoint_policies.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpointPolicies[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("location", AAZStrType, ".location") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _elements.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties.serviceEndpointPolicies[].properties") - if properties is not None: - properties.set_prop("serviceEndpointPolicyDefinitions", AAZListType, ".service_endpoint_policy_definitions") - - service_endpoint_policy_definitions = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions") - if service_endpoint_policy_definitions is not None: - service_endpoint_policy_definitions.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[].properties") - if properties is not None: - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("service", AAZStrType, ".service") - properties.set_prop("serviceResources", AAZListType, ".service_resources") - - service_resources = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[].properties.serviceResources") - if service_resources is not None: - service_resources.set_elements(AAZStrType, ".") - - tags = _builder.get(".properties.serviceEndpointPolicies[].tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - service_endpoints = _builder.get(".properties.serviceEndpoints") - if service_endpoints is not None: - service_endpoints.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpoints[]") - if _elements is not None: - _elements.set_prop("locations", AAZListType, ".locations") - _elements.set_prop("provisioningState", AAZStrType, ".provisioning_state") - _elements.set_prop("service", AAZStrType, ".service") - - locations = _builder.get(".properties.serviceEndpoints[].locations") - if locations is not None: - locations.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_subnet_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_application_security_group_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_create(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_create(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_show.py deleted file mode 100644 index ecd84089ad3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_show.py +++ /dev/null @@ -1,1439 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Show details of a subnet. - - :example: Show the details of a subnet associated with a virtual network. - az network vnet subnet show -g MyResourceGroup -n MySubnet --vnet-name MyVNet - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2018-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - id_part="child_name_1", - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - id_part="name", - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SubnetsGet(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 SubnetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_subnet_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_update.py deleted file mode 100644 index 39dd5061c10..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/network/vnet/subnet/_update.py +++ /dev/null @@ -1,2174 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Update(AAZCommand): - """Update a subnet. - - :example: Associate a network security group to a subnet. - az network vnet subnet update -g MyResourceGroup -n MySubnet --vnet-name MyVNet --network-security-group MyNsg - - :example: Update subnet with NAT gateway. - az network vnet subnet update -n MySubnet --vnet-name MyVnet -g MyResourceGroup --nat-gateway MyNatGateway --address-prefixes "10.0.0.0/21" - - :example: Disable the private endpoint network policies - az network vnet subnet update -n MySubnet --vnet-name MyVnet -g MyResourceGroup --disable-private-endpoint-network-policies - - :example: Detach a network security group in a subnet. - az network vnet subnet update -g MyResourceGroup --vnet-name MyVNet -n MySubnet --nsg null - """ - - _aaz_info = { - "version": "2018-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/virtualnetworks/{}/subnets/{}", "2018-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name"], - help="The subnet name.", - required=True, - id_part="child_name_1", - ) - _args_schema.vnet_name = AAZStrArg( - options=["--vnet-name"], - help="The virtual network (VNet) name.", - required=True, - id_part="name", - ) - _args_schema.address_prefix = AAZStrArg( - options=["--address-prefix"], - help="The address prefix for the subnet.", - nullable=True, - ) - _args_schema.address_prefixes = AAZListArg( - options=["--address-prefixes"], - help="Space-separated list of address prefixes in CIDR format.", - nullable=True, - ) - _args_schema.delegated_services = AAZListArg( - options=["--delegated-services"], - help="Space-separated list of services to whom the subnet should be delegated, e.g., `Microsoft.Sql/servers`.", - nullable=True, - ) - _args_schema.network_security_group = AAZResourceIdArg( - options=["--nsg", "--network-security-group"], - help="Name or ID of a network security group (NSG). Use null to detach it.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/networkSecurityGroups/{}", - ), - ) - _args_schema.route_table = AAZResourceIdArg( - options=["--route-table"], - help="Name or ID of a route table to associate with the subnet. Use null to detach it.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/routeTables/{}", - ), - ) - _args_schema.policies = AAZListArg( - options=["--policies"], - help="An array of service endpoint policies.", - nullable=True, - ) - _args_schema.endpoints = AAZListArg( - options=["--endpoints"], - help="An array of service endpoints.", - nullable=True, - ) - - address_prefixes = cls._args_schema.address_prefixes - address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - delegated_services = cls._args_schema.delegated_services - delegated_services.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.delegated_services.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a subnet. This name can be used to access the resource.", - nullable=True, - ) - _element.actions = AAZListArg( - options=["actions"], - help="Describes the actions permitted to the service upon delegation", - nullable=True, - ) - _element.service_name = AAZStrArg( - options=["service-name"], - help="The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers).", - nullable=True, - ) - - actions = cls._args_schema.delegated_services.Element.actions - actions.Element = AAZStrArg( - nullable=True, - ) - - policies = cls._args_schema.policies - policies.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.policies.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}", - ), - ) - _element.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _element.service_endpoint_policy_definitions = AAZListArg( - options=["service-endpoint-policy-definitions"], - help="A collection of service endpoint policy definitions of the service endpoint policy.", - nullable=True, - ) - _element.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - service_endpoint_policy_definitions = cls._args_schema.policies.Element.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.policies.Element.service_endpoint_policy_definitions.Element - _element.etag = AAZStrArg( - options=["etag"], - help="A unique read-only string that changes whenever the resource is updated.", - nullable=True, - ) - _element.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/serviceEndpointPolicies/{}/serviceEndpointPolicyDefinitions/{}", - ), - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - _element.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - _element.service = AAZStrArg( - options=["service"], - help="Service endpoint name.", - nullable=True, - ) - _element.service_resources = AAZListArg( - options=["service-resources"], - help="A list of service resources.", - nullable=True, - ) - - service_resources = cls._args_schema.policies.Element.service_endpoint_policy_definitions.Element.service_resources - service_resources.Element = AAZStrArg( - nullable=True, - ) - - tags = cls._args_schema.policies.Element.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - endpoints = cls._args_schema.endpoints - endpoints.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.endpoints.Element - _element.locations = AAZListArg( - options=["locations"], - help="A list of locations.", - nullable=True, - ) - _element.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the resource.", - nullable=True, - ) - _element.service = AAZStrArg( - options=["service"], - help="The type of the endpoint service.", - nullable=True, - ) - - locations = cls._args_schema.endpoints.Element.locations - locations.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "NetworkSecurityGroup" - - # define Arg Group "Properties" - - # define Arg Group "RouteTable" - - # define Arg Group "SubnetParameters" - return cls._args_schema - - _args_application_security_group_update = None - - @classmethod - def _build_args_application_security_group_update(cls, _schema): - if cls._args_application_security_group_update is not None: - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - return - - cls._args_application_security_group_update = AAZObjectArg( - nullable=True, - ) - - application_security_group_update = cls._args_application_security_group_update - application_security_group_update.id = AAZResourceIdArg( - options=["id"], - help="Resource ID.", - nullable=True, - fmt=AAZResourceIdArgFormat( - template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/applicationSecurityGroups/{}", - ), - ) - application_security_group_update.location = AAZResourceLocationArg( - options=["l", "location"], - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - application_security_group_update.tags = AAZDictArg( - options=["tags"], - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_application_security_group_update.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - _schema.id = cls._args_application_security_group_update.id - _schema.location = cls._args_application_security_group_update.location - _schema.tags = cls._args_application_security_group_update.tags - - _args_security_rule_update = None - - @classmethod - def _build_args_security_rule_update(cls, _schema): - if cls._args_security_rule_update is not None: - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - return - - cls._args_security_rule_update = AAZObjectArg( - nullable=True, - ) - - security_rule_update = cls._args_security_rule_update - security_rule_update.name = AAZStrArg( - options=["name"], - help="The name of the resource that is unique within a resource group. This name can be used to access the resource.", - nullable=True, - ) - security_rule_update.access = AAZStrArg( - options=["access"], - help="The network traffic is allowed or denied. Possible values are: 'Allow' and 'Deny'.", - enum={"Allow": "Allow", "Deny": "Deny"}, - ) - security_rule_update.description = AAZStrArg( - options=["description"], - help="A description for this rule. Restricted to 140 chars.", - nullable=True, - ) - security_rule_update.destination_address_prefix = AAZStrArg( - options=["destination-address-prefix"], - help="The destination address prefix. CIDR or destination IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used.", - nullable=True, - ) - security_rule_update.destination_address_prefixes = AAZListArg( - options=["destination-address-prefixes"], - help="The destination address prefixes. CIDR or destination IP ranges.", - nullable=True, - ) - security_rule_update.destination_application_security_groups = AAZListArg( - options=["destination-application-security-groups"], - help="The application security group specified as destination.", - nullable=True, - ) - security_rule_update.destination_port_range = AAZStrArg( - options=["destination-port-range"], - help="The destination port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.destination_port_ranges = AAZListArg( - options=["destination-port-ranges"], - help="The destination port ranges.", - nullable=True, - ) - security_rule_update.direction = AAZStrArg( - options=["direction"], - help="The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values are: 'Inbound' and 'Outbound'.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - security_rule_update.priority = AAZIntArg( - options=["priority"], - help="The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.", - nullable=True, - ) - security_rule_update.protocol = AAZStrArg( - options=["protocol"], - help="Network protocol this rule applies to. Possible values are 'Tcp', 'Udp', and '*'.", - enum={"*": "*", "Tcp": "Tcp", "Udp": "Udp"}, - ) - security_rule_update.provisioning_state = AAZStrArg( - options=["provisioning-state"], - help="The provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.", - nullable=True, - ) - security_rule_update.source_address_prefix = AAZStrArg( - options=["source-address-prefix"], - help="The CIDR or source IP range. Asterisks '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. ", - nullable=True, - ) - security_rule_update.source_address_prefixes = AAZListArg( - options=["source-address-prefixes"], - help="The CIDR or source IP ranges.", - nullable=True, - ) - security_rule_update.source_application_security_groups = AAZListArg( - options=["source-application-security-groups"], - help="The application security group specified as source.", - nullable=True, - ) - security_rule_update.source_port_range = AAZStrArg( - options=["source-port-range"], - help="The source port or range. Integer or range between 0 and 65535. Asterisks '*' can also be used to match all ports.", - nullable=True, - ) - security_rule_update.source_port_ranges = AAZListArg( - options=["source-port-ranges"], - help="The source port ranges.", - nullable=True, - ) - - destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - destination_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(destination_application_security_groups.Element) - - destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - destination_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - source_address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - source_application_security_groups.Element = AAZObjectArg( - nullable=True, - ) - cls._build_args_application_security_group_update(source_application_security_groups.Element) - - source_port_ranges = cls._args_security_rule_update.source_port_ranges - source_port_ranges.Element = AAZStrArg( - nullable=True, - ) - - _schema.access = cls._args_security_rule_update.access - _schema.description = cls._args_security_rule_update.description - _schema.destination_address_prefix = cls._args_security_rule_update.destination_address_prefix - _schema.destination_address_prefixes = cls._args_security_rule_update.destination_address_prefixes - _schema.destination_application_security_groups = cls._args_security_rule_update.destination_application_security_groups - _schema.destination_port_range = cls._args_security_rule_update.destination_port_range - _schema.destination_port_ranges = cls._args_security_rule_update.destination_port_ranges - _schema.direction = cls._args_security_rule_update.direction - _schema.name = cls._args_security_rule_update.name - _schema.priority = cls._args_security_rule_update.priority - _schema.protocol = cls._args_security_rule_update.protocol - _schema.provisioning_state = cls._args_security_rule_update.provisioning_state - _schema.source_address_prefix = cls._args_security_rule_update.source_address_prefix - _schema.source_address_prefixes = cls._args_security_rule_update.source_address_prefixes - _schema.source_application_security_groups = cls._args_security_rule_update.source_application_security_groups - _schema.source_port_range = cls._args_security_rule_update.source_port_range - _schema.source_port_ranges = cls._args_security_rule_update.source_port_ranges - - def _execute_operations(self): - self.pre_operations() - self.SubnetsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.SubnetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class SubnetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2018-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_subnet_read(cls._schema_on_200) - - return cls._schema_on_200 - - class SubnetsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subnetName", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualNetworkName", self.ctx.args.vnet_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2018-11-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_subnet_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefix", AAZStrType, ".address_prefix") - properties.set_prop("addressPrefixes", AAZListType, ".address_prefixes") - properties.set_prop("delegations", AAZListType, ".delegated_services") - properties.set_prop("networkSecurityGroup", AAZObjectType) - properties.set_prop("routeTable", AAZObjectType) - properties.set_prop("serviceEndpointPolicies", AAZListType, ".policies") - properties.set_prop("serviceEndpoints", AAZListType, ".endpoints") - - address_prefixes = _builder.get(".properties.addressPrefixes") - if address_prefixes is not None: - address_prefixes.set_elements(AAZStrType, ".") - - delegations = _builder.get(".properties.delegations") - if delegations is not None: - delegations.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.delegations[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.delegations[].properties") - if properties is not None: - properties.set_prop("actions", AAZListType, ".actions") - properties.set_prop("serviceName", AAZStrType, ".service_name") - - actions = _builder.get(".properties.delegations[].properties.actions") - if actions is not None: - actions.set_elements(AAZStrType, ".") - - network_security_group = _builder.get(".properties.networkSecurityGroup") - if network_security_group is not None: - network_security_group.set_prop("id", AAZStrType, ".network_security_group") - network_security_group.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - route_table = _builder.get(".properties.routeTable") - if route_table is not None: - route_table.set_prop("id", AAZStrType, ".route_table") - route_table.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - service_endpoint_policies = _builder.get(".properties.serviceEndpointPolicies") - if service_endpoint_policies is not None: - service_endpoint_policies.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpointPolicies[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("location", AAZStrType, ".location") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _elements.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties.serviceEndpointPolicies[].properties") - if properties is not None: - properties.set_prop("serviceEndpointPolicyDefinitions", AAZListType, ".service_endpoint_policy_definitions") - - service_endpoint_policy_definitions = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions") - if service_endpoint_policy_definitions is not None: - service_endpoint_policy_definitions.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[]") - if _elements is not None: - _elements.set_prop("etag", AAZStrType, ".etag") - _elements.set_prop("id", AAZStrType, ".id") - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[].properties") - if properties is not None: - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("service", AAZStrType, ".service") - properties.set_prop("serviceResources", AAZListType, ".service_resources") - - service_resources = _builder.get(".properties.serviceEndpointPolicies[].properties.serviceEndpointPolicyDefinitions[].properties.serviceResources") - if service_resources is not None: - service_resources.set_elements(AAZStrType, ".") - - tags = _builder.get(".properties.serviceEndpointPolicies[].tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - service_endpoints = _builder.get(".properties.serviceEndpoints") - if service_endpoints is not None: - service_endpoints.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.serviceEndpoints[]") - if _elements is not None: - _elements.set_prop("locations", AAZListType, ".locations") - _elements.set_prop("provisioningState", AAZStrType, ".provisioning_state") - _elements.set_prop("service", AAZStrType, ".service") - - locations = _builder.get(".properties.serviceEndpoints[].locations") - if locations is not None: - locations.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_application_security_group_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - @classmethod - def _build_schema_security_rule_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("name", AAZStrType, ".name") - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("access", AAZStrType, ".access", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("destinationAddressPrefix", AAZStrType, ".destination_address_prefix") - properties.set_prop("destinationAddressPrefixes", AAZListType, ".destination_address_prefixes") - properties.set_prop("destinationApplicationSecurityGroups", AAZListType, ".destination_application_security_groups") - properties.set_prop("destinationPortRange", AAZStrType, ".destination_port_range") - properties.set_prop("destinationPortRanges", AAZListType, ".destination_port_ranges") - properties.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("priority", AAZIntType, ".priority") - properties.set_prop("protocol", AAZStrType, ".protocol", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("provisioningState", AAZStrType, ".provisioning_state") - properties.set_prop("sourceAddressPrefix", AAZStrType, ".source_address_prefix") - properties.set_prop("sourceAddressPrefixes", AAZListType, ".source_address_prefixes") - properties.set_prop("sourceApplicationSecurityGroups", AAZListType, ".source_application_security_groups") - properties.set_prop("sourcePortRange", AAZStrType, ".source_port_range") - properties.set_prop("sourcePortRanges", AAZListType, ".source_port_ranges") - - destination_address_prefixes = _builder.get(".properties.destinationAddressPrefixes") - if destination_address_prefixes is not None: - destination_address_prefixes.set_elements(AAZStrType, ".") - - destination_application_security_groups = _builder.get(".properties.destinationApplicationSecurityGroups") - if destination_application_security_groups is not None: - cls._build_schema_application_security_group_update(destination_application_security_groups.set_elements(AAZObjectType, ".")) - - destination_port_ranges = _builder.get(".properties.destinationPortRanges") - if destination_port_ranges is not None: - destination_port_ranges.set_elements(AAZStrType, ".") - - source_address_prefixes = _builder.get(".properties.sourceAddressPrefixes") - if source_address_prefixes is not None: - source_address_prefixes.set_elements(AAZStrType, ".") - - source_application_security_groups = _builder.get(".properties.sourceApplicationSecurityGroups") - if source_application_security_groups is not None: - cls._build_schema_application_security_group_update(source_application_security_groups.set_elements(AAZObjectType, ".")) - - source_port_ranges = _builder.get(".properties.sourcePortRanges") - if source_port_ranges is not None: - source_port_ranges.set_elements(AAZStrType, ".") - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_interface_endpoint_read = None - - @classmethod - def _build_schema_interface_endpoint_read(cls, _schema): - if cls._schema_interface_endpoint_read is not None: - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - return - - cls._schema_interface_endpoint_read = _schema_interface_endpoint_read = AAZObjectType() - - interface_endpoint_read = _schema_interface_endpoint_read - interface_endpoint_read.etag = AAZStrType() - interface_endpoint_read.id = AAZStrType() - interface_endpoint_read.location = AAZStrType() - interface_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - interface_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - interface_endpoint_read.tags = AAZDictType() - interface_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_interface_endpoint_read.properties - properties.endpoint_service = AAZObjectType( - serialized_name="endpointService", - ) - properties.fqdn = AAZStrType() - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.owner = AAZStrType( - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - endpoint_service = _schema_interface_endpoint_read.properties.endpoint_service - endpoint_service.id = AAZStrType() - - network_interfaces = _schema_interface_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - tags = _schema_interface_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_interface_endpoint_read.etag - _schema.id = cls._schema_interface_endpoint_read.id - _schema.location = cls._schema_interface_endpoint_read.location - _schema.name = cls._schema_interface_endpoint_read.name - _schema.properties = cls._schema_interface_endpoint_read.properties - _schema.tags = cls._schema_interface_endpoint_read.tags - _schema.type = cls._schema_interface_endpoint_read.type - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.interface_endpoint = AAZObjectType( - serialized_name="interfaceEndpoint", - ) - cls._build_schema_interface_endpoint_read(properties.interface_endpoint) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.interface_endpoints = AAZListType( - serialized_name="interfaceEndpoints", - flags={"read_only": True}, - ) - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - interface_endpoints = _schema_subnet_read.properties.interface_endpoints - interface_endpoints.Element = AAZObjectType() - cls._build_schema_interface_endpoint_read(interface_endpoints.Element) - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/__cmd_group.py deleted file mode 100644 index 03df0bf6e77..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "ppg", -) -class __CMDGroup(AAZCommandGroup): - """Manage Proximity Placement Groups. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/__init__.py deleted file mode 100644 index c401f439385..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_create.py deleted file mode 100644 index 7993036bf47..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_create.py +++ /dev/null @@ -1,322 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "ppg create", -) -class Create(AAZCommand): - """Create a proximity placement group. - - :example: Create a proximity placement group. - az ppg create --name MyProximityPlacementGroup --resource-group MyResourceGroup - - :example: Create a proximity placement group with specifying VM sizes that can be created. - az ppg create --name MyProximityPlacementGroup --resource-group MyResourceGroup --intent-vm-sizes Standard_E64s_v4 Standard_M416ms_v2 - - :example: Create a proximity placement group with specifying VM sizes that can be created and availability zone. - az ppg create --name MyProximityPlacementGroup --resource-group MyResourceGroup --intent-vm-sizes Standard_E64s_v4 Standard_M416ms_v2 --zone 1 - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/proximityplacementgroups/{}", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.proximity_placement_group_name = AAZStrArg( - options=["-n", "--name", "--proximity-placement-group-name"], - help="The name of the proximity placement group.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.ppg_type = AAZStrArg( - options=["-t", "--type", "--ppg-type"], - help="The type of the proximity placement group. Allowed values: Standard.", - enum={"Standard": "Standard", "Ultra": "Ultra"}, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Space-separated tags: key[=value] [key[=value] ...].", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ProximityPlacementGroupsCreateOrUpdate(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 ProximityPlacementGroupsCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "proximityPlacementGroupName", self.ctx.args.proximity_placement_group_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("proximityPlacementGroupType", AAZStrType, ".ppg_type") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200_201.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.availability_sets = AAZListType( - serialized_name="availabilitySets", - flags={"read_only": True}, - ) - properties.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - _CreateHelper._build_schema_instance_view_status_read(properties.colocation_status) - properties.proximity_placement_group_type = AAZStrType( - serialized_name="proximityPlacementGroupType", - ) - properties.virtual_machine_scale_sets = AAZListType( - serialized_name="virtualMachineScaleSets", - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - flags={"read_only": True}, - ) - - availability_sets = cls._schema_on_200_201.properties.availability_sets - availability_sets.Element = AAZObjectType() - _CreateHelper._build_schema_sub_resource_with_colocation_status_read(availability_sets.Element) - - virtual_machine_scale_sets = cls._schema_on_200_201.properties.virtual_machine_scale_sets - virtual_machine_scale_sets.Element = AAZObjectType() - _CreateHelper._build_schema_sub_resource_with_colocation_status_read(virtual_machine_scale_sets.Element) - - virtual_machines = cls._schema_on_200_201.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - _CreateHelper._build_schema_sub_resource_with_colocation_status_read(virtual_machines.Element) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - _schema_instance_view_status_read = None - - @classmethod - def _build_schema_instance_view_status_read(cls, _schema): - if cls._schema_instance_view_status_read is not None: - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - return - - cls._schema_instance_view_status_read = _schema_instance_view_status_read = AAZObjectType() - - instance_view_status_read = _schema_instance_view_status_read - instance_view_status_read.code = AAZStrType() - instance_view_status_read.display_status = AAZStrType( - serialized_name="displayStatus", - ) - instance_view_status_read.level = AAZStrType() - instance_view_status_read.message = AAZStrType() - instance_view_status_read.time = AAZStrType() - - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - - _schema_sub_resource_with_colocation_status_read = None - - @classmethod - def _build_schema_sub_resource_with_colocation_status_read(cls, _schema): - if cls._schema_sub_resource_with_colocation_status_read is not None: - _schema.colocation_status = cls._schema_sub_resource_with_colocation_status_read.colocation_status - _schema.id = cls._schema_sub_resource_with_colocation_status_read.id - return - - cls._schema_sub_resource_with_colocation_status_read = _schema_sub_resource_with_colocation_status_read = AAZObjectType() - - sub_resource_with_colocation_status_read = _schema_sub_resource_with_colocation_status_read - sub_resource_with_colocation_status_read.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - cls._build_schema_instance_view_status_read(sub_resource_with_colocation_status_read.colocation_status) - sub_resource_with_colocation_status_read.id = AAZStrType() - - _schema.colocation_status = cls._schema_sub_resource_with_colocation_status_read.colocation_status - _schema.id = cls._schema_sub_resource_with_colocation_status_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_delete.py deleted file mode 100644 index 7cf11d3bdf0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_delete.py +++ /dev/null @@ -1,130 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "ppg delete", -) -class Delete(AAZCommand): - """Delete a proximity placement group. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/proximityplacementgroups/{}", "2020-06-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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 "" - - _args_schema = cls._args_schema - _args_schema.proximity_placement_group_name = AAZStrArg( - options=["-n", "--name", "--proximity-placement-group-name"], - help="The name of the proximity placement group.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ProximityPlacementGroupsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class ProximityPlacementGroupsDelete(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "proximityPlacementGroupName", self.ctx.args.proximity_placement_group_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_list.py deleted file mode 100644 index 031882264ea..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_list.py +++ /dev/null @@ -1,412 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "ppg list", -) -class List(AAZCommand): - """List proximity placement groups. - - :example: List proximity placement groups. - az ppg list --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/proximityplacementgroups", "2020-06-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/proximityplacementgroups", "2020-06-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.ProximityPlacementGroupsListByResourceGroup(ctx=self.ctx)() - if condition_1: - self.ProximityPlacementGroupsListBySubscription(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class ProximityPlacementGroupsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.availability_sets = AAZListType( - serialized_name="availabilitySets", - flags={"read_only": True}, - ) - properties.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - _ListHelper._build_schema_instance_view_status_read(properties.colocation_status) - properties.proximity_placement_group_type = AAZStrType( - serialized_name="proximityPlacementGroupType", - ) - properties.virtual_machine_scale_sets = AAZListType( - serialized_name="virtualMachineScaleSets", - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - flags={"read_only": True}, - ) - - availability_sets = cls._schema_on_200.value.Element.properties.availability_sets - availability_sets.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_with_colocation_status_read(availability_sets.Element) - - virtual_machine_scale_sets = cls._schema_on_200.value.Element.properties.virtual_machine_scale_sets - virtual_machine_scale_sets.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_with_colocation_status_read(virtual_machine_scale_sets.Element) - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_with_colocation_status_read(virtual_machines.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class ProximityPlacementGroupsListBySubscription(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.Compute/proximityPlacementGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.availability_sets = AAZListType( - serialized_name="availabilitySets", - flags={"read_only": True}, - ) - properties.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - _ListHelper._build_schema_instance_view_status_read(properties.colocation_status) - properties.proximity_placement_group_type = AAZStrType( - serialized_name="proximityPlacementGroupType", - ) - properties.virtual_machine_scale_sets = AAZListType( - serialized_name="virtualMachineScaleSets", - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - flags={"read_only": True}, - ) - - availability_sets = cls._schema_on_200.value.Element.properties.availability_sets - availability_sets.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_with_colocation_status_read(availability_sets.Element) - - virtual_machine_scale_sets = cls._schema_on_200.value.Element.properties.virtual_machine_scale_sets - virtual_machine_scale_sets.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_with_colocation_status_read(virtual_machine_scale_sets.Element) - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_with_colocation_status_read(virtual_machines.Element) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_instance_view_status_read = None - - @classmethod - def _build_schema_instance_view_status_read(cls, _schema): - if cls._schema_instance_view_status_read is not None: - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - return - - cls._schema_instance_view_status_read = _schema_instance_view_status_read = AAZObjectType() - - instance_view_status_read = _schema_instance_view_status_read - instance_view_status_read.code = AAZStrType() - instance_view_status_read.display_status = AAZStrType( - serialized_name="displayStatus", - ) - instance_view_status_read.level = AAZStrType() - instance_view_status_read.message = AAZStrType() - instance_view_status_read.time = AAZStrType() - - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - - _schema_sub_resource_with_colocation_status_read = None - - @classmethod - def _build_schema_sub_resource_with_colocation_status_read(cls, _schema): - if cls._schema_sub_resource_with_colocation_status_read is not None: - _schema.colocation_status = cls._schema_sub_resource_with_colocation_status_read.colocation_status - _schema.id = cls._schema_sub_resource_with_colocation_status_read.id - return - - cls._schema_sub_resource_with_colocation_status_read = _schema_sub_resource_with_colocation_status_read = AAZObjectType() - - sub_resource_with_colocation_status_read = _schema_sub_resource_with_colocation_status_read - sub_resource_with_colocation_status_read.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - cls._build_schema_instance_view_status_read(sub_resource_with_colocation_status_read.colocation_status) - sub_resource_with_colocation_status_read.id = AAZStrType() - - _schema.colocation_status = cls._schema_sub_resource_with_colocation_status_read.colocation_status - _schema.id = cls._schema_sub_resource_with_colocation_status_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_show.py deleted file mode 100644 index 80b570596b3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_show.py +++ /dev/null @@ -1,273 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "ppg show", -) -class Show(AAZCommand): - """Get a proximity placement group. - - :example: Get a proximity placement group (commonly used with --output). (autogenerated) - az ppg show --name MyProximityPlacementGroup --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/proximityplacementgroups/{}", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.proximity_placement_group_name = AAZStrArg( - options=["-n", "--name", "--proximity-placement-group-name"], - help="The name of the proximity placement group.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.include_colocation_status = AAZStrArg( - options=["--include-colocation-status"], - help="Enable fetching the colocation status of all the resources in the proximity placement group.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ProximityPlacementGroupsGet(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 ProximityPlacementGroupsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "proximityPlacementGroupName", self.ctx.args.proximity_placement_group_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "includeColocationStatus", self.ctx.args.include_colocation_status, - ), - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.availability_sets = AAZListType( - serialized_name="availabilitySets", - flags={"read_only": True}, - ) - properties.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - _ShowHelper._build_schema_instance_view_status_read(properties.colocation_status) - properties.proximity_placement_group_type = AAZStrType( - serialized_name="proximityPlacementGroupType", - ) - properties.virtual_machine_scale_sets = AAZListType( - serialized_name="virtualMachineScaleSets", - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - flags={"read_only": True}, - ) - - availability_sets = cls._schema_on_200.properties.availability_sets - availability_sets.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_with_colocation_status_read(availability_sets.Element) - - virtual_machine_scale_sets = cls._schema_on_200.properties.virtual_machine_scale_sets - virtual_machine_scale_sets.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_with_colocation_status_read(virtual_machine_scale_sets.Element) - - virtual_machines = cls._schema_on_200.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_with_colocation_status_read(virtual_machines.Element) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_instance_view_status_read = None - - @classmethod - def _build_schema_instance_view_status_read(cls, _schema): - if cls._schema_instance_view_status_read is not None: - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - return - - cls._schema_instance_view_status_read = _schema_instance_view_status_read = AAZObjectType() - - instance_view_status_read = _schema_instance_view_status_read - instance_view_status_read.code = AAZStrType() - instance_view_status_read.display_status = AAZStrType( - serialized_name="displayStatus", - ) - instance_view_status_read.level = AAZStrType() - instance_view_status_read.message = AAZStrType() - instance_view_status_read.time = AAZStrType() - - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - - _schema_sub_resource_with_colocation_status_read = None - - @classmethod - def _build_schema_sub_resource_with_colocation_status_read(cls, _schema): - if cls._schema_sub_resource_with_colocation_status_read is not None: - _schema.colocation_status = cls._schema_sub_resource_with_colocation_status_read.colocation_status - _schema.id = cls._schema_sub_resource_with_colocation_status_read.id - return - - cls._schema_sub_resource_with_colocation_status_read = _schema_sub_resource_with_colocation_status_read = AAZObjectType() - - sub_resource_with_colocation_status_read = _schema_sub_resource_with_colocation_status_read - sub_resource_with_colocation_status_read.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - cls._build_schema_instance_view_status_read(sub_resource_with_colocation_status_read.colocation_status) - sub_resource_with_colocation_status_read.id = AAZStrType() - - _schema.colocation_status = cls._schema_sub_resource_with_colocation_status_read.colocation_status - _schema.id = cls._schema_sub_resource_with_colocation_status_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_update.py deleted file mode 100644 index 4238e4f0ac1..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/ppg/_update.py +++ /dev/null @@ -1,502 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "ppg update", -) -class Update(AAZCommand): - """Update a proximity placement group. - - :example: Update a proximity placement group with specifying VM sizes that can be created. - az ppg update --name MyProximityPlacementGroup --resource-group MyResourceGroup --intent-vm-sizes Standard_E64s_v4 Standard_M416ms_v2 - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/proximityplacementgroups/{}", "2020-06-01"], - ] - } - - AZ_SUPPORT_GENERIC_UPDATE = True - - 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 "" - - _args_schema = cls._args_schema - _args_schema.proximity_placement_group_name = AAZStrArg( - options=["-n", "--name", "--proximity-placement-group-name"], - help="The name of the proximity placement group.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.colocation_status = AAZObjectArg( - options=["--colocation-status"], - help="Describes colocation status of the Proximity Placement Group.", - nullable=True, - ) - _args_schema.ppg_type = AAZStrArg( - options=["-t", "--type", "--ppg-type"], - help="The type of the proximity placement group. Allowed values: Standard.", - nullable=True, - enum={"Standard": "Standard", "Ultra": "Ultra"}, - ) - - colocation_status = cls._args_schema.colocation_status - colocation_status.code = AAZStrArg( - options=["code"], - help="The status code.", - nullable=True, - ) - colocation_status.display_status = AAZStrArg( - options=["display-status"], - help="The short localizable label for the status.", - nullable=True, - ) - colocation_status.level = AAZStrArg( - options=["level"], - help="The level code.", - nullable=True, - enum={"Error": "Error", "Info": "Info", "Warning": "Warning"}, - ) - colocation_status.message = AAZStrArg( - options=["message"], - help="The detailed status message, including for alerts and error messages.", - nullable=True, - ) - colocation_status.time = AAZDateTimeArg( - options=["time"], - help="The time of the status.", - nullable=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Space-separated tags: key[=value] [key[=value] ...].", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ProximityPlacementGroupsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.ProximityPlacementGroupsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class ProximityPlacementGroupsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "proximityPlacementGroupName", self.ctx.args.proximity_placement_group_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_proximity_placement_group_read(cls._schema_on_200) - - return cls._schema_on_200 - - class ProximityPlacementGroupsCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "proximityPlacementGroupName", self.ctx.args.proximity_placement_group_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_proximity_placement_group_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("colocationStatus", AAZObjectType, ".colocation_status") - properties.set_prop("proximityPlacementGroupType", AAZStrType, ".ppg_type") - - colocation_status = _builder.get(".properties.colocationStatus") - if colocation_status is not None: - colocation_status.set_prop("code", AAZStrType, ".code") - colocation_status.set_prop("displayStatus", AAZStrType, ".display_status") - colocation_status.set_prop("level", AAZStrType, ".level") - colocation_status.set_prop("message", AAZStrType, ".message") - colocation_status.set_prop("time", AAZStrType, ".time") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - _schema_instance_view_status_read = None - - @classmethod - def _build_schema_instance_view_status_read(cls, _schema): - if cls._schema_instance_view_status_read is not None: - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - return - - cls._schema_instance_view_status_read = _schema_instance_view_status_read = AAZObjectType() - - instance_view_status_read = _schema_instance_view_status_read - instance_view_status_read.code = AAZStrType() - instance_view_status_read.display_status = AAZStrType( - serialized_name="displayStatus", - ) - instance_view_status_read.level = AAZStrType() - instance_view_status_read.message = AAZStrType() - instance_view_status_read.time = AAZStrType() - - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - - _schema_proximity_placement_group_read = None - - @classmethod - def _build_schema_proximity_placement_group_read(cls, _schema): - if cls._schema_proximity_placement_group_read is not None: - _schema.id = cls._schema_proximity_placement_group_read.id - _schema.location = cls._schema_proximity_placement_group_read.location - _schema.name = cls._schema_proximity_placement_group_read.name - _schema.properties = cls._schema_proximity_placement_group_read.properties - _schema.tags = cls._schema_proximity_placement_group_read.tags - _schema.type = cls._schema_proximity_placement_group_read.type - return - - cls._schema_proximity_placement_group_read = _schema_proximity_placement_group_read = AAZObjectType() - - proximity_placement_group_read = _schema_proximity_placement_group_read - proximity_placement_group_read.id = AAZStrType( - flags={"read_only": True}, - ) - proximity_placement_group_read.location = AAZStrType( - flags={"required": True}, - ) - proximity_placement_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - proximity_placement_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - proximity_placement_group_read.tags = AAZDictType() - proximity_placement_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_proximity_placement_group_read.properties - properties.availability_sets = AAZListType( - serialized_name="availabilitySets", - flags={"read_only": True}, - ) - properties.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - cls._build_schema_instance_view_status_read(properties.colocation_status) - properties.proximity_placement_group_type = AAZStrType( - serialized_name="proximityPlacementGroupType", - ) - properties.virtual_machine_scale_sets = AAZListType( - serialized_name="virtualMachineScaleSets", - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - flags={"read_only": True}, - ) - - availability_sets = _schema_proximity_placement_group_read.properties.availability_sets - availability_sets.Element = AAZObjectType() - cls._build_schema_sub_resource_with_colocation_status_read(availability_sets.Element) - - virtual_machine_scale_sets = _schema_proximity_placement_group_read.properties.virtual_machine_scale_sets - virtual_machine_scale_sets.Element = AAZObjectType() - cls._build_schema_sub_resource_with_colocation_status_read(virtual_machine_scale_sets.Element) - - virtual_machines = _schema_proximity_placement_group_read.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - cls._build_schema_sub_resource_with_colocation_status_read(virtual_machines.Element) - - tags = _schema_proximity_placement_group_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_proximity_placement_group_read.id - _schema.location = cls._schema_proximity_placement_group_read.location - _schema.name = cls._schema_proximity_placement_group_read.name - _schema.properties = cls._schema_proximity_placement_group_read.properties - _schema.tags = cls._schema_proximity_placement_group_read.tags - _schema.type = cls._schema_proximity_placement_group_read.type - - _schema_sub_resource_with_colocation_status_read = None - - @classmethod - def _build_schema_sub_resource_with_colocation_status_read(cls, _schema): - if cls._schema_sub_resource_with_colocation_status_read is not None: - _schema.colocation_status = cls._schema_sub_resource_with_colocation_status_read.colocation_status - _schema.id = cls._schema_sub_resource_with_colocation_status_read.id - return - - cls._schema_sub_resource_with_colocation_status_read = _schema_sub_resource_with_colocation_status_read = AAZObjectType() - - sub_resource_with_colocation_status_read = _schema_sub_resource_with_colocation_status_read - sub_resource_with_colocation_status_read.colocation_status = AAZObjectType( - serialized_name="colocationStatus", - ) - cls._build_schema_instance_view_status_read(sub_resource_with_colocation_status_read.colocation_status) - sub_resource_with_colocation_status_read.id = AAZStrType() - - _schema.colocation_status = cls._schema_sub_resource_with_colocation_status_read.colocation_status - _schema.id = cls._schema_sub_resource_with_colocation_status_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/__cmd_group.py deleted file mode 100644 index 58173b06c0c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig", -) -class __CMDGroup(AAZCommandGroup): - """Manage shared image gallery. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/__init__.py deleted file mode 100644 index 2d1a2078686..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_create.py deleted file mode 100644 index a451430e71a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_create.py +++ /dev/null @@ -1,289 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig create", -) -class Create(AAZCommand): - """Create a shared image gallery. - - :example: Create a shared image gallery - az sig create --resource-group MyResourceGroup --gallery-name MyGallery - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2019-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery to be deleted.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Gallery" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Gallery", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Gallery", - help="Space-separated tags: key[=value] [key[=value] ...]. Use \"\" to clear existing tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.description = AAZStrArg( - options=["--description"], - arg_group="Properties", - help="The description of the gallery.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.GalleriesCreateOrUpdate(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 GalleriesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("description", AAZStrType, ".description") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_gallery_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - _schema_gallery_read = None - - @classmethod - def _build_schema_gallery_read(cls, _schema): - if cls._schema_gallery_read is not None: - _schema.id = cls._schema_gallery_read.id - _schema.location = cls._schema_gallery_read.location - _schema.name = cls._schema_gallery_read.name - _schema.properties = cls._schema_gallery_read.properties - _schema.tags = cls._schema_gallery_read.tags - _schema.type = cls._schema_gallery_read.type - return - - cls._schema_gallery_read = _schema_gallery_read = AAZObjectType() - - gallery_read = _schema_gallery_read - gallery_read.id = AAZStrType( - flags={"read_only": True}, - ) - gallery_read.location = AAZStrType( - flags={"required": True}, - ) - gallery_read.name = AAZStrType( - flags={"read_only": True}, - ) - gallery_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - gallery_read.tags = AAZDictType() - gallery_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_gallery_read.properties - properties.description = AAZStrType() - properties.identifier = AAZObjectType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - identifier = _schema_gallery_read.properties.identifier - identifier.unique_name = AAZStrType( - serialized_name="uniqueName", - flags={"read_only": True}, - ) - - tags = _schema_gallery_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_gallery_read.id - _schema.location = cls._schema_gallery_read.location - _schema.name = cls._schema_gallery_read.name - _schema.properties = cls._schema_gallery_read.properties - _schema.tags = cls._schema_gallery_read.tags - _schema.type = cls._schema_gallery_read.type - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_delete.py deleted file mode 100644 index cbd48b43866..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_delete.py +++ /dev/null @@ -1,159 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig delete", -) -class Delete(AAZCommand): - """Delete a Shared Image Gallery. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2019-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery to be deleted.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.GalleriesDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class GalleriesDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_list.py deleted file mode 100644 index ac7df2b69f8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_list.py +++ /dev/null @@ -1,321 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig list", -) -class List(AAZCommand): - """List galleries under a resource group. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/galleries", "2019-12-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries", "2019-12-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.GalleriesList(ctx=self.ctx)() - if condition_1: - self.GalleriesListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class GalleriesList(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.Compute/galleries", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.description = AAZStrType() - properties.identifier = AAZObjectType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - identifier = cls._schema_on_200.value.Element.properties.identifier - identifier.unique_name = AAZStrType( - serialized_name="uniqueName", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class GalleriesListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.description = AAZStrType() - properties.identifier = AAZObjectType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - identifier = cls._schema_on_200.value.Element.properties.identifier - identifier.unique_name = AAZStrType( - serialized_name="uniqueName", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_show.py deleted file mode 100644 index 8488abc3664..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_show.py +++ /dev/null @@ -1,194 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig show", -) -class Show(AAZCommand): - """Retrieve information about a Shared Image Gallery. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2019-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery to be deleted.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.GalleriesGet(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 GalleriesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType() - properties.identifier = AAZObjectType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - identifier = cls._schema_on_200.properties.identifier - identifier.unique_name = AAZStrType( - serialized_name="uniqueName", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_wait.py deleted file mode 100644 index c1f9e597b52..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/_wait.py +++ /dev/null @@ -1,193 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}", "2019-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery to be deleted.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.GalleriesGet(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=False) - return result - - class GalleriesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType() - properties.identifier = AAZObjectType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - identifier = cls._schema_on_200.properties.identifier - identifier.unique_name = AAZStrType( - serialized_name="uniqueName", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/__cmd_group.py deleted file mode 100644 index d4a50a30ec6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-definition", -) -class __CMDGroup(AAZCommandGroup): - """Manage shared gallery image with VM - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_create.py deleted file mode 100644 index 8f6c2e968f6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_create.py +++ /dev/null @@ -1,584 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a gallery image definition. - """ - - _aaz_info = { - "version": "2021-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}", "2021-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_name = AAZStrArg( - options=["-n", "--name", "--gallery-image-name"], - help="The name of the gallery image definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.", - required=True, - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery in which the Image Definition resides.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "GalleryImage" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="GalleryImage", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="GalleryImage", - help="Resource tags", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.architecture = AAZStrArg( - options=["--architecture"], - arg_group="Properties", - help="The architecture of the image. Applicable to OS disks only.", - enum={"Arm64": "Arm64", "x64": "x64"}, - ) - _args_schema.description = AAZStrArg( - options=["--description"], - arg_group="Properties", - help="The description of this gallery image definition resource. This property is updatable.", - ) - _args_schema.disallowed = AAZObjectArg( - options=["--disallowed"], - arg_group="Properties", - help="Describes the disallowed disk types.", - ) - _args_schema.end_of_life_date = AAZDateTimeArg( - options=["--end-of-life-date"], - arg_group="Properties", - help="The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable.", - ) - _args_schema.eula = AAZStrArg( - options=["--eula"], - arg_group="Properties", - help="The Eula agreement for the gallery image definition.", - ) - _args_schema.features = AAZListArg( - options=["--features"], - arg_group="Properties", - help="A list of gallery image features.", - ) - _args_schema.hyper_v_generation = AAZStrArg( - options=["--hyper-v-generation"], - arg_group="Properties", - help="The hypervisor generation of the Virtual Machine. Applicable to OS disks only.", - enum={"V1": "V1", "V2": "V2"}, - ) - _args_schema.identifier = AAZObjectArg( - options=["--identifier"], - arg_group="Properties", - help="This is the gallery image definition identifier.", - ) - _args_schema.os_state = AAZStrArg( - options=["--os-state"], - arg_group="Properties", - help="This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'.", - enum={"Generalized": "Generalized", "Specialized": "Specialized"}, - ) - _args_schema.os_type = AAZStrArg( - options=["--os-type"], - arg_group="Properties", - help="This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed image.

Possible values are:

**Windows**

**Linux**", - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - _args_schema.privacy_statement_uri = AAZStrArg( - options=["--privacy-statement-uri"], - arg_group="Properties", - help="The privacy statement uri.", - ) - _args_schema.purchase_plan = AAZObjectArg( - options=["--purchase-plan"], - arg_group="Properties", - help="Describes the gallery image definition purchase plan. This is used by marketplace images.", - ) - _args_schema.recommended = AAZObjectArg( - options=["--recommended"], - arg_group="Properties", - help="The properties describe the recommended machine configuration for this Image Definition. These properties are updatable.", - ) - _args_schema.release_note_uri = AAZStrArg( - options=["--release-note-uri"], - arg_group="Properties", - help="The release note uri.", - ) - - disallowed = cls._args_schema.disallowed - disallowed.disk_types = AAZListArg( - options=["disk-types"], - help="A list of disk types.", - ) - - disk_types = cls._args_schema.disallowed.disk_types - disk_types.Element = AAZStrArg() - - features = cls._args_schema.features - features.Element = AAZObjectArg() - - _element = cls._args_schema.features.Element - _element.name = AAZStrArg( - options=["name"], - help="The name of the gallery image feature.", - ) - _element.value = AAZStrArg( - options=["value"], - help="The value of the gallery image feature.", - ) - - identifier = cls._args_schema.identifier - identifier.offer = AAZStrArg( - options=["offer"], - help="The name of the gallery image definition offer.", - required=True, - ) - identifier.publisher = AAZStrArg( - options=["publisher"], - help="The name of the gallery image definition publisher.", - required=True, - ) - identifier.sku = AAZStrArg( - options=["sku"], - help="The name of the gallery image definition SKU.", - required=True, - ) - - purchase_plan = cls._args_schema.purchase_plan - purchase_plan.name = AAZStrArg( - options=["name"], - help="The plan ID.", - ) - purchase_plan.product = AAZStrArg( - options=["product"], - help="The product ID.", - ) - purchase_plan.publisher = AAZStrArg( - options=["publisher"], - help="The publisher ID.", - ) - - recommended = cls._args_schema.recommended - recommended.memory = AAZObjectArg( - options=["memory"], - ) - cls._build_args_resource_range_create(recommended.memory) - recommended.v_cp_us = AAZObjectArg( - options=["v-cp-us"], - help="Describes the resource range.", - ) - cls._build_args_resource_range_create(recommended.v_cp_us) - return cls._args_schema - - _args_resource_range_create = None - - @classmethod - def _build_args_resource_range_create(cls, _schema): - if cls._args_resource_range_create is not None: - _schema.max = cls._args_resource_range_create.max - _schema.min = cls._args_resource_range_create.min - return - - cls._args_resource_range_create = AAZObjectArg() - - resource_range_create = cls._args_resource_range_create - resource_range_create.max = AAZIntArg( - options=["max"], - help="The maximum number of the resource.", - ) - resource_range_create.min = AAZIntArg( - options=["min"], - help="The minimum number of the resource.", - ) - - _schema.max = cls._args_resource_range_create.max - _schema.min = cls._args_resource_range_create.min - - def _execute_operations(self): - self.pre_operations() - yield self.GalleryImagesCreateOrUpdate(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 GalleryImagesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_name, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2021-10-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("architecture", AAZStrType, ".architecture") - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("disallowed", AAZObjectType, ".disallowed") - properties.set_prop("endOfLifeDate", AAZStrType, ".end_of_life_date") - properties.set_prop("eula", AAZStrType, ".eula") - properties.set_prop("features", AAZListType, ".features") - properties.set_prop("hyperVGeneration", AAZStrType, ".hyper_v_generation") - properties.set_prop("identifier", AAZObjectType, ".identifier", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("osState", AAZStrType, ".os_state", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("osType", AAZStrType, ".os_type", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("privacyStatementUri", AAZStrType, ".privacy_statement_uri") - properties.set_prop("purchasePlan", AAZObjectType, ".purchase_plan") - properties.set_prop("recommended", AAZObjectType, ".recommended") - properties.set_prop("releaseNoteUri", AAZStrType, ".release_note_uri") - - disallowed = _builder.get(".properties.disallowed") - if disallowed is not None: - disallowed.set_prop("diskTypes", AAZListType, ".disk_types") - - disk_types = _builder.get(".properties.disallowed.diskTypes") - if disk_types is not None: - disk_types.set_elements(AAZStrType, ".") - - features = _builder.get(".properties.features") - if features is not None: - features.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.features[]") - if _elements is not None: - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("value", AAZStrType, ".value") - - identifier = _builder.get(".properties.identifier") - if identifier is not None: - identifier.set_prop("offer", AAZStrType, ".offer", typ_kwargs={"flags": {"required": True}}) - identifier.set_prop("publisher", AAZStrType, ".publisher", typ_kwargs={"flags": {"required": True}}) - identifier.set_prop("sku", AAZStrType, ".sku", typ_kwargs={"flags": {"required": True}}) - - purchase_plan = _builder.get(".properties.purchasePlan") - if purchase_plan is not None: - purchase_plan.set_prop("name", AAZStrType, ".name") - purchase_plan.set_prop("product", AAZStrType, ".product") - purchase_plan.set_prop("publisher", AAZStrType, ".publisher") - - recommended = _builder.get(".properties.recommended") - if recommended is not None: - _CreateHelper._build_schema_resource_range_create(recommended.set_prop("memory", AAZObjectType, ".memory")) - _CreateHelper._build_schema_resource_range_create(recommended.set_prop("vCPUs", AAZObjectType, ".v_cp_us")) - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_gallery_image_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_resource_range_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("max", AAZIntType, ".max") - _builder.set_prop("min", AAZIntType, ".min") - - _schema_gallery_image_read = None - - @classmethod - def _build_schema_gallery_image_read(cls, _schema): - if cls._schema_gallery_image_read is not None: - _schema.id = cls._schema_gallery_image_read.id - _schema.location = cls._schema_gallery_image_read.location - _schema.name = cls._schema_gallery_image_read.name - _schema.properties = cls._schema_gallery_image_read.properties - _schema.tags = cls._schema_gallery_image_read.tags - _schema.type = cls._schema_gallery_image_read.type - return - - cls._schema_gallery_image_read = _schema_gallery_image_read = AAZObjectType() - - gallery_image_read = _schema_gallery_image_read - gallery_image_read.id = AAZStrType( - flags={"read_only": True}, - ) - gallery_image_read.location = AAZStrType( - flags={"required": True}, - ) - gallery_image_read.name = AAZStrType( - flags={"read_only": True}, - ) - gallery_image_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - gallery_image_read.tags = AAZDictType() - gallery_image_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_gallery_image_read.properties - properties.architecture = AAZStrType() - properties.description = AAZStrType() - properties.disallowed = AAZObjectType() - properties.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - properties.eula = AAZStrType() - properties.features = AAZListType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.identifier = AAZObjectType( - flags={"required": True}, - ) - properties.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - properties.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - properties.privacy_statement_uri = AAZStrType( - serialized_name="privacyStatementUri", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.purchase_plan = AAZObjectType( - serialized_name="purchasePlan", - ) - properties.recommended = AAZObjectType() - properties.release_note_uri = AAZStrType( - serialized_name="releaseNoteUri", - ) - - disallowed = _schema_gallery_image_read.properties.disallowed - disallowed.disk_types = AAZListType( - serialized_name="diskTypes", - ) - - disk_types = _schema_gallery_image_read.properties.disallowed.disk_types - disk_types.Element = AAZStrType() - - features = _schema_gallery_image_read.properties.features - features.Element = AAZObjectType() - - _element = _schema_gallery_image_read.properties.features.Element - _element.name = AAZStrType() - _element.value = AAZStrType() - - identifier = _schema_gallery_image_read.properties.identifier - identifier.offer = AAZStrType( - flags={"required": True}, - ) - identifier.publisher = AAZStrType( - flags={"required": True}, - ) - identifier.sku = AAZStrType( - flags={"required": True}, - ) - - purchase_plan = _schema_gallery_image_read.properties.purchase_plan - purchase_plan.name = AAZStrType() - purchase_plan.product = AAZStrType() - purchase_plan.publisher = AAZStrType() - - recommended = _schema_gallery_image_read.properties.recommended - recommended.memory = AAZObjectType() - cls._build_schema_resource_range_read(recommended.memory) - recommended.v_cp_us = AAZObjectType( - serialized_name="vCPUs", - ) - cls._build_schema_resource_range_read(recommended.v_cp_us) - - tags = _schema_gallery_image_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_gallery_image_read.id - _schema.location = cls._schema_gallery_image_read.location - _schema.name = cls._schema_gallery_image_read.name - _schema.properties = cls._schema_gallery_image_read.properties - _schema.tags = cls._schema_gallery_image_read.tags - _schema.type = cls._schema_gallery_image_read.type - - _schema_resource_range_read = None - - @classmethod - def _build_schema_resource_range_read(cls, _schema): - if cls._schema_resource_range_read is not None: - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - return - - cls._schema_resource_range_read = _schema_resource_range_read = AAZObjectType() - - resource_range_read = _schema_resource_range_read - resource_range_read.max = AAZIntType() - resource_range_read.min = AAZIntType() - - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_delete.py deleted file mode 100644 index 983ec457b3b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_delete.py +++ /dev/null @@ -1,169 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-definition delete", -) -class Delete(AAZCommand): - """Delete a gallery image. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}", "2019-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-name", "--gallery-image-definition"], - help="The name of the gallery image definition to be deleted.", - required=True, - id_part="child_name_1", - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery in which the Image Definition is to be deleted.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.GalleryImagesDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class GalleryImagesDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_list.py deleted file mode 100644 index 7bd5af9341d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_list.py +++ /dev/null @@ -1,278 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-definition list", -) -class List(AAZCommand): - """List gallery image definitions in a gallery. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images", "2019-12-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery from which Image Definitions are to be listed.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.GalleryImagesListByGallery(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class GalleryImagesListByGallery(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.description = AAZStrType() - properties.disallowed = AAZObjectType() - properties.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - properties.eula = AAZStrType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.identifier = AAZObjectType( - flags={"required": True}, - ) - properties.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - properties.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - properties.privacy_statement_uri = AAZStrType( - serialized_name="privacyStatementUri", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.purchase_plan = AAZObjectType( - serialized_name="purchasePlan", - ) - properties.recommended = AAZObjectType() - properties.release_note_uri = AAZStrType( - serialized_name="releaseNoteUri", - ) - - disallowed = cls._schema_on_200.value.Element.properties.disallowed - disallowed.disk_types = AAZListType( - serialized_name="diskTypes", - ) - - disk_types = cls._schema_on_200.value.Element.properties.disallowed.disk_types - disk_types.Element = AAZStrType() - - identifier = cls._schema_on_200.value.Element.properties.identifier - identifier.offer = AAZStrType( - flags={"required": True}, - ) - identifier.publisher = AAZStrType( - flags={"required": True}, - ) - identifier.sku = AAZStrType( - flags={"required": True}, - ) - - purchase_plan = cls._schema_on_200.value.Element.properties.purchase_plan - purchase_plan.name = AAZStrType() - purchase_plan.product = AAZStrType() - purchase_plan.publisher = AAZStrType() - - recommended = cls._schema_on_200.value.Element.properties.recommended - recommended.memory = AAZObjectType() - _ListHelper._build_schema_resource_range_read(recommended.memory) - recommended.v_cp_us = AAZObjectType( - serialized_name="vCPUs", - ) - _ListHelper._build_schema_resource_range_read(recommended.v_cp_us) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_resource_range_read = None - - @classmethod - def _build_schema_resource_range_read(cls, _schema): - if cls._schema_resource_range_read is not None: - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - return - - cls._schema_resource_range_read = _schema_resource_range_read = AAZObjectType() - - resource_range_read = _schema_resource_range_read - resource_range_read.max = AAZIntType() - resource_range_read.min = AAZIntType() - - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_show.py deleted file mode 100644 index 8a96ac5f56b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_show.py +++ /dev/null @@ -1,276 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-definition show", -) -class Show(AAZCommand): - """Get information about a gallery image definition. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}", "2019-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-name", "--gallery-image-definition"], - help="The name of the gallery image definition to be retrieved.", - required=True, - id_part="child_name_1", - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery from which the Image Definitions are to be retrieved.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.GalleryImagesGet(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 GalleryImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType() - properties.disallowed = AAZObjectType() - properties.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - properties.eula = AAZStrType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.identifier = AAZObjectType( - flags={"required": True}, - ) - properties.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - properties.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - properties.privacy_statement_uri = AAZStrType( - serialized_name="privacyStatementUri", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.purchase_plan = AAZObjectType( - serialized_name="purchasePlan", - ) - properties.recommended = AAZObjectType() - properties.release_note_uri = AAZStrType( - serialized_name="releaseNoteUri", - ) - - disallowed = cls._schema_on_200.properties.disallowed - disallowed.disk_types = AAZListType( - serialized_name="diskTypes", - ) - - disk_types = cls._schema_on_200.properties.disallowed.disk_types - disk_types.Element = AAZStrType() - - identifier = cls._schema_on_200.properties.identifier - identifier.offer = AAZStrType( - flags={"required": True}, - ) - identifier.publisher = AAZStrType( - flags={"required": True}, - ) - identifier.sku = AAZStrType( - flags={"required": True}, - ) - - purchase_plan = cls._schema_on_200.properties.purchase_plan - purchase_plan.name = AAZStrType() - purchase_plan.product = AAZStrType() - purchase_plan.publisher = AAZStrType() - - recommended = cls._schema_on_200.properties.recommended - recommended.memory = AAZObjectType() - _ShowHelper._build_schema_resource_range_read(recommended.memory) - recommended.v_cp_us = AAZObjectType( - serialized_name="vCPUs", - ) - _ShowHelper._build_schema_resource_range_read(recommended.v_cp_us) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_resource_range_read = None - - @classmethod - def _build_schema_resource_range_read(cls, _schema): - if cls._schema_resource_range_read is not None: - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - return - - cls._schema_resource_range_read = _schema_resource_range_read = AAZObjectType() - - resource_range_read = _schema_resource_range_read - resource_range_read.max = AAZIntType() - resource_range_read.min = AAZIntType() - - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_update.py deleted file mode 100644 index 08076149999..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_update.py +++ /dev/null @@ -1,744 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-definition update", -) -class Update(AAZCommand): - """Update a VM Image definition. - - :example: Change the shared image definition's recommended configuration - az sig image-definition update --resource-group MyResourceGroup --gallery-name MyGallery --gallery-image-definition MyImage --resource-group MyResourceGroup --set recommended.vCpUs.min=myNewvCpUsMin recommended.vCpUs.max=myNewvCpUsMax recommended.memory.min=myNewMemoryMin recommended.memory.max=myNewMemoryMax description="newDescription" - - :example: Remove a shared image definition's configuration property - az sig image-definition update --resource-group MyResourceGroup --gallery-name MyGallery --gallery-image-definition MyImage --resource-group MyResourceGroup --remove recommended.vCpUs.min - """ - - _aaz_info = { - "version": "2021-10-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}", "2021-10-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-definition"], - help="The name of the gallery image definition to be retrieved.", - required=True, - id_part="child_name_1", - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery in which the Image Definition resides.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "GalleryImage" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="GalleryImage", - help="Resource location", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="GalleryImage", - help="Resource tags", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.architecture = AAZStrArg( - options=["--architecture"], - arg_group="Properties", - help="The architecture of the image. Applicable to OS disks only.", - nullable=True, - enum={"Arm64": "Arm64", "x64": "x64"}, - ) - _args_schema.description = AAZStrArg( - options=["--description"], - arg_group="Properties", - help="The description of this gallery image definition resource. This property is updatable.", - nullable=True, - ) - _args_schema.disallowed = AAZObjectArg( - options=["--disallowed"], - arg_group="Properties", - help="Describes the disallowed disk types.", - nullable=True, - ) - _args_schema.end_of_life_date = AAZDateTimeArg( - options=["--end-of-life-date"], - arg_group="Properties", - help="The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable.", - nullable=True, - ) - _args_schema.eula = AAZStrArg( - options=["--eula"], - arg_group="Properties", - help="The Eula agreement for the gallery image definition.", - nullable=True, - ) - _args_schema.features = AAZListArg( - options=["--features"], - arg_group="Properties", - help="A list of gallery image features.", - nullable=True, - ) - _args_schema.hyper_v_generation = AAZStrArg( - options=["--hyper-v-generation"], - arg_group="Properties", - help="The hypervisor generation of the Virtual Machine. Applicable to OS disks only.", - nullable=True, - enum={"V1": "V1", "V2": "V2"}, - ) - _args_schema.identifier = AAZObjectArg( - options=["--identifier"], - arg_group="Properties", - help="This is the gallery image definition identifier.", - ) - _args_schema.os_state = AAZStrArg( - options=["--os-state"], - arg_group="Properties", - help="This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'.", - enum={"Generalized": "Generalized", "Specialized": "Specialized"}, - ) - _args_schema.os_type = AAZStrArg( - options=["--os-type"], - arg_group="Properties", - help="This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed image.

Possible values are:

**Windows**

**Linux**", - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - _args_schema.privacy_statement_uri = AAZStrArg( - options=["--privacy-statement-uri"], - arg_group="Properties", - help="The privacy statement uri.", - nullable=True, - ) - _args_schema.purchase_plan = AAZObjectArg( - options=["--purchase-plan"], - arg_group="Properties", - help="Describes the gallery image definition purchase plan. This is used by marketplace images.", - nullable=True, - ) - _args_schema.recommended = AAZObjectArg( - options=["--recommended"], - arg_group="Properties", - help="The properties describe the recommended machine configuration for this Image Definition. These properties are updatable.", - nullable=True, - ) - _args_schema.release_note_uri = AAZStrArg( - options=["--release-note-uri"], - arg_group="Properties", - help="The release note uri.", - nullable=True, - ) - - disallowed = cls._args_schema.disallowed - disallowed.disk_types = AAZListArg( - options=["disk-types"], - help="A list of disk types.", - nullable=True, - ) - - disk_types = cls._args_schema.disallowed.disk_types - disk_types.Element = AAZStrArg( - nullable=True, - ) - - features = cls._args_schema.features - features.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.features.Element - _element.name = AAZStrArg( - options=["name"], - help="The name of the gallery image feature.", - nullable=True, - ) - _element.value = AAZStrArg( - options=["value"], - help="The value of the gallery image feature.", - nullable=True, - ) - - identifier = cls._args_schema.identifier - identifier.offer = AAZStrArg( - options=["offer"], - help="The name of the gallery image definition offer.", - ) - identifier.publisher = AAZStrArg( - options=["publisher"], - help="The name of the gallery image definition publisher.", - ) - identifier.sku = AAZStrArg( - options=["sku"], - help="The name of the gallery image definition SKU.", - ) - - purchase_plan = cls._args_schema.purchase_plan - purchase_plan.name = AAZStrArg( - options=["name"], - help="The plan ID.", - nullable=True, - ) - purchase_plan.product = AAZStrArg( - options=["product"], - help="The product ID.", - nullable=True, - ) - purchase_plan.publisher = AAZStrArg( - options=["publisher"], - help="The publisher ID.", - nullable=True, - ) - - recommended = cls._args_schema.recommended - recommended.memory = AAZObjectArg( - options=["memory"], - nullable=True, - ) - cls._build_args_resource_range_update(recommended.memory) - recommended.v_cp_us = AAZObjectArg( - options=["v-cp-us"], - help="Describes the resource range.", - nullable=True, - ) - cls._build_args_resource_range_update(recommended.v_cp_us) - return cls._args_schema - - _args_resource_range_update = None - - @classmethod - def _build_args_resource_range_update(cls, _schema): - if cls._args_resource_range_update is not None: - _schema.max = cls._args_resource_range_update.max - _schema.min = cls._args_resource_range_update.min - return - - cls._args_resource_range_update = AAZObjectArg( - nullable=True, - ) - - resource_range_update = cls._args_resource_range_update - resource_range_update.max = AAZIntArg( - options=["max"], - help="The maximum number of the resource.", - nullable=True, - ) - resource_range_update.min = AAZIntArg( - options=["min"], - help="The minimum number of the resource.", - nullable=True, - ) - - _schema.max = cls._args_resource_range_update.max - _schema.min = cls._args_resource_range_update.min - - def _execute_operations(self): - self.pre_operations() - self.GalleryImagesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.GalleryImagesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class GalleryImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2021-10-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_gallery_image_read(cls._schema_on_200) - - return cls._schema_on_200 - - class GalleryImagesCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2021-10-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_gallery_image_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("architecture", AAZStrType, ".architecture") - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("disallowed", AAZObjectType, ".disallowed") - properties.set_prop("endOfLifeDate", AAZStrType, ".end_of_life_date") - properties.set_prop("eula", AAZStrType, ".eula") - properties.set_prop("features", AAZListType, ".features") - properties.set_prop("hyperVGeneration", AAZStrType, ".hyper_v_generation") - properties.set_prop("identifier", AAZObjectType, ".identifier", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("osState", AAZStrType, ".os_state", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("osType", AAZStrType, ".os_type", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("privacyStatementUri", AAZStrType, ".privacy_statement_uri") - properties.set_prop("purchasePlan", AAZObjectType, ".purchase_plan") - properties.set_prop("recommended", AAZObjectType, ".recommended") - properties.set_prop("releaseNoteUri", AAZStrType, ".release_note_uri") - - disallowed = _builder.get(".properties.disallowed") - if disallowed is not None: - disallowed.set_prop("diskTypes", AAZListType, ".disk_types") - - disk_types = _builder.get(".properties.disallowed.diskTypes") - if disk_types is not None: - disk_types.set_elements(AAZStrType, ".") - - features = _builder.get(".properties.features") - if features is not None: - features.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.features[]") - if _elements is not None: - _elements.set_prop("name", AAZStrType, ".name") - _elements.set_prop("value", AAZStrType, ".value") - - identifier = _builder.get(".properties.identifier") - if identifier is not None: - identifier.set_prop("offer", AAZStrType, ".offer", typ_kwargs={"flags": {"required": True}}) - identifier.set_prop("publisher", AAZStrType, ".publisher", typ_kwargs={"flags": {"required": True}}) - identifier.set_prop("sku", AAZStrType, ".sku", typ_kwargs={"flags": {"required": True}}) - - purchase_plan = _builder.get(".properties.purchasePlan") - if purchase_plan is not None: - purchase_plan.set_prop("name", AAZStrType, ".name") - purchase_plan.set_prop("product", AAZStrType, ".product") - purchase_plan.set_prop("publisher", AAZStrType, ".publisher") - - recommended = _builder.get(".properties.recommended") - if recommended is not None: - _UpdateHelper._build_schema_resource_range_update(recommended.set_prop("memory", AAZObjectType, ".memory")) - _UpdateHelper._build_schema_resource_range_update(recommended.set_prop("vCPUs", AAZObjectType, ".v_cp_us")) - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_resource_range_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("max", AAZIntType, ".max") - _builder.set_prop("min", AAZIntType, ".min") - - _schema_gallery_image_read = None - - @classmethod - def _build_schema_gallery_image_read(cls, _schema): - if cls._schema_gallery_image_read is not None: - _schema.id = cls._schema_gallery_image_read.id - _schema.location = cls._schema_gallery_image_read.location - _schema.name = cls._schema_gallery_image_read.name - _schema.properties = cls._schema_gallery_image_read.properties - _schema.tags = cls._schema_gallery_image_read.tags - _schema.type = cls._schema_gallery_image_read.type - return - - cls._schema_gallery_image_read = _schema_gallery_image_read = AAZObjectType() - - gallery_image_read = _schema_gallery_image_read - gallery_image_read.id = AAZStrType( - flags={"read_only": True}, - ) - gallery_image_read.location = AAZStrType( - flags={"required": True}, - ) - gallery_image_read.name = AAZStrType( - flags={"read_only": True}, - ) - gallery_image_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - gallery_image_read.tags = AAZDictType() - gallery_image_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_gallery_image_read.properties - properties.architecture = AAZStrType() - properties.description = AAZStrType() - properties.disallowed = AAZObjectType() - properties.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - properties.eula = AAZStrType() - properties.features = AAZListType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.identifier = AAZObjectType( - flags={"required": True}, - ) - properties.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - properties.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - properties.privacy_statement_uri = AAZStrType( - serialized_name="privacyStatementUri", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.purchase_plan = AAZObjectType( - serialized_name="purchasePlan", - ) - properties.recommended = AAZObjectType() - properties.release_note_uri = AAZStrType( - serialized_name="releaseNoteUri", - ) - - disallowed = _schema_gallery_image_read.properties.disallowed - disallowed.disk_types = AAZListType( - serialized_name="diskTypes", - ) - - disk_types = _schema_gallery_image_read.properties.disallowed.disk_types - disk_types.Element = AAZStrType() - - features = _schema_gallery_image_read.properties.features - features.Element = AAZObjectType() - - _element = _schema_gallery_image_read.properties.features.Element - _element.name = AAZStrType() - _element.value = AAZStrType() - - identifier = _schema_gallery_image_read.properties.identifier - identifier.offer = AAZStrType( - flags={"required": True}, - ) - identifier.publisher = AAZStrType( - flags={"required": True}, - ) - identifier.sku = AAZStrType( - flags={"required": True}, - ) - - purchase_plan = _schema_gallery_image_read.properties.purchase_plan - purchase_plan.name = AAZStrType() - purchase_plan.product = AAZStrType() - purchase_plan.publisher = AAZStrType() - - recommended = _schema_gallery_image_read.properties.recommended - recommended.memory = AAZObjectType() - cls._build_schema_resource_range_read(recommended.memory) - recommended.v_cp_us = AAZObjectType( - serialized_name="vCPUs", - ) - cls._build_schema_resource_range_read(recommended.v_cp_us) - - tags = _schema_gallery_image_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_gallery_image_read.id - _schema.location = cls._schema_gallery_image_read.location - _schema.name = cls._schema_gallery_image_read.name - _schema.properties = cls._schema_gallery_image_read.properties - _schema.tags = cls._schema_gallery_image_read.tags - _schema.type = cls._schema_gallery_image_read.type - - _schema_resource_range_read = None - - @classmethod - def _build_schema_resource_range_read(cls, _schema): - if cls._schema_resource_range_read is not None: - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - return - - cls._schema_resource_range_read = _schema_resource_range_read = AAZObjectType() - - resource_range_read = _schema_resource_range_read - resource_range_read.max = AAZIntType() - resource_range_read.min = AAZIntType() - - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_wait.py deleted file mode 100644 index c67527d616f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_definition/_wait.py +++ /dev/null @@ -1,275 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-definition wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}", "2019-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-name", "--gallery-image-definition"], - help="The name of the gallery image definition to be retrieved.", - required=True, - id_part="child_name_1", - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery from which the Image Definitions are to be retrieved.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.GalleryImagesGet(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=False) - return result - - class GalleryImagesGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType() - properties.disallowed = AAZObjectType() - properties.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - properties.eula = AAZStrType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.identifier = AAZObjectType( - flags={"required": True}, - ) - properties.os_state = AAZStrType( - serialized_name="osState", - flags={"required": True}, - ) - properties.os_type = AAZStrType( - serialized_name="osType", - flags={"required": True}, - ) - properties.privacy_statement_uri = AAZStrType( - serialized_name="privacyStatementUri", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.purchase_plan = AAZObjectType( - serialized_name="purchasePlan", - ) - properties.recommended = AAZObjectType() - properties.release_note_uri = AAZStrType( - serialized_name="releaseNoteUri", - ) - - disallowed = cls._schema_on_200.properties.disallowed - disallowed.disk_types = AAZListType( - serialized_name="diskTypes", - ) - - disk_types = cls._schema_on_200.properties.disallowed.disk_types - disk_types.Element = AAZStrType() - - identifier = cls._schema_on_200.properties.identifier - identifier.offer = AAZStrType( - flags={"required": True}, - ) - identifier.publisher = AAZStrType( - flags={"required": True}, - ) - identifier.sku = AAZStrType( - flags={"required": True}, - ) - - purchase_plan = cls._schema_on_200.properties.purchase_plan - purchase_plan.name = AAZStrType() - purchase_plan.product = AAZStrType() - purchase_plan.publisher = AAZStrType() - - recommended = cls._schema_on_200.properties.recommended - recommended.memory = AAZObjectType() - _WaitHelper._build_schema_resource_range_read(recommended.memory) - recommended.v_cp_us = AAZObjectType( - serialized_name="vCPUs", - ) - _WaitHelper._build_schema_resource_range_read(recommended.v_cp_us) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_resource_range_read = None - - @classmethod - def _build_schema_resource_range_read(cls, _schema): - if cls._schema_resource_range_read is not None: - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - return - - cls._schema_resource_range_read = _schema_resource_range_read = AAZObjectType() - - resource_range_read = _schema_resource_range_read - resource_range_read.max = AAZIntType() - resource_range_read.min = AAZIntType() - - _schema.max = cls._schema_resource_range_read.max - _schema.min = cls._schema_resource_range_read.min - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/__cmd_group.py deleted file mode 100644 index 95920e9da1b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-version", -) -class __CMDGroup(AAZCommandGroup): - """Manage shared gallery image version with VM - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/__init__.py deleted file mode 100644 index db73033039b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_create.py deleted file mode 100644 index 722f769c4c4..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_create.py +++ /dev/null @@ -1,662 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Create(AAZCommand): - """Create a gallery image version. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2019-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-definition"], - help="The name of the gallery image definition in which the Image Version resides.", - required=True, - ) - _args_schema.gallery_image_version_name = AAZStrArg( - options=["-e", "--gallery-image-version", "--gallery-image-version-name"], - help="The name of the gallery image version to be deleted.", - required=True, - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery in which the Image Definition resides.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "GalleryImageVersion" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="GalleryImageVersion", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="GalleryImageVersion", - help="Resource tags", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.publishing_profile = AAZObjectArg( - options=["--publishing-profile"], - arg_group="Properties", - help="The publishing profile of a gallery image Version.", - ) - _args_schema.storage_profile = AAZObjectArg( - options=["--storage-profile"], - arg_group="Properties", - help="This is the storage profile of a Gallery Image Version.", - ) - - publishing_profile = cls._args_schema.publishing_profile - publishing_profile.end_of_life_date = AAZDateTimeArg( - options=["end-of-life-date"], - help="The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property is updatable.", - ) - publishing_profile.exclude_from_latest = AAZBoolArg( - options=["exclude-from-latest"], - help="If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version.", - ) - publishing_profile.replica_count = AAZIntArg( - options=["replica-count"], - help="The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable.", - ) - publishing_profile.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type to be used to store the image. This property is not updatable.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"}, - ) - publishing_profile.target_regions = AAZListArg( - options=["target-regions"], - help="The target regions where the Image Version is going to be replicated to. This property is updatable.", - ) - - target_regions = cls._args_schema.publishing_profile.target_regions - target_regions.Element = AAZObjectArg() - - _element = cls._args_schema.publishing_profile.target_regions.Element - _element.encryption = AAZObjectArg( - options=["encryption"], - help="Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact.", - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the region.", - required=True, - ) - _element.regional_replica_count = AAZIntArg( - options=["regional-replica-count"], - help="The number of replicas of the Image Version to be created per region. This property is updatable.", - ) - _element.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type to be used to store the image. This property is not updatable.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"}, - ) - - encryption = cls._args_schema.publishing_profile.target_regions.Element.encryption - encryption.data_disk_images = AAZListArg( - options=["data-disk-images"], - help="A list of encryption specifications for data disk images.", - ) - encryption.os_disk_image = AAZObjectArg( - options=["os-disk-image"], - help="Contains encryption settings for an OS disk image.", - ) - - data_disk_images = cls._args_schema.publishing_profile.target_regions.Element.encryption.data_disk_images - data_disk_images.Element = AAZObjectArg() - - _element = cls._args_schema.publishing_profile.target_regions.Element.encryption.data_disk_images.Element - _element.disk_encryption_set_id = AAZStrArg( - options=["disk-encryption-set-id"], - help="A relative URI containing the resource ID of the disk encryption set.", - ) - _element.lun = AAZIntArg( - options=["lun"], - help="This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine.", - required=True, - ) - - os_disk_image = cls._args_schema.publishing_profile.target_regions.Element.encryption.os_disk_image - os_disk_image.disk_encryption_set_id = AAZStrArg( - options=["disk-encryption-set-id"], - help="A relative URI containing the resource ID of the disk encryption set.", - ) - - storage_profile = cls._args_schema.storage_profile - storage_profile.data_disk_images = AAZListArg( - options=["data-disk-images"], - help="A list of data disk images.", - ) - storage_profile.os_disk_image = AAZObjectArg( - options=["os-disk-image"], - help="This is the OS disk image.", - ) - storage_profile.source = AAZObjectArg( - options=["source"], - help="The source of the gallery artifact version.", - ) - - data_disk_images = cls._args_schema.storage_profile.data_disk_images - data_disk_images.Element = AAZObjectArg() - - _element = cls._args_schema.storage_profile.data_disk_images.Element - _element.host_caching = AAZStrArg( - options=["host-caching"], - help="The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'", - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - _element.lun = AAZIntArg( - options=["lun"], - help="This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine.", - required=True, - ) - _element.source = AAZObjectArg( - options=["source"], - ) - cls._build_args_gallery_artifact_version_source_create(_element.source) - - os_disk_image = cls._args_schema.storage_profile.os_disk_image - os_disk_image.host_caching = AAZStrArg( - options=["host-caching"], - help="The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'", - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - os_disk_image.source = AAZObjectArg( - options=["source"], - help="The source for the disk image.", - ) - cls._build_args_gallery_artifact_version_source_create(os_disk_image.source) - - source = cls._args_schema.storage_profile.source - source.id = AAZStrArg( - options=["id"], - help="The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource.", - ) - return cls._args_schema - - _args_gallery_artifact_version_source_create = None - - @classmethod - def _build_args_gallery_artifact_version_source_create(cls, _schema): - if cls._args_gallery_artifact_version_source_create is not None: - _schema.id = cls._args_gallery_artifact_version_source_create.id - return - - cls._args_gallery_artifact_version_source_create = AAZObjectArg() - - gallery_artifact_version_source_create = cls._args_gallery_artifact_version_source_create - gallery_artifact_version_source_create.id = AAZStrArg( - options=["id"], - help="The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, or user image.", - ) - - _schema.id = cls._args_gallery_artifact_version_source_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.GalleryImageVersionsCreateOrUpdate(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 GalleryImageVersionsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryImageVersionName", self.ctx.args.gallery_image_version_name, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("publishingProfile", AAZObjectType, ".publishing_profile") - properties.set_prop("storageProfile", AAZObjectType, ".storage_profile", typ_kwargs={"flags": {"required": True}}) - - publishing_profile = _builder.get(".properties.publishingProfile") - if publishing_profile is not None: - publishing_profile.set_prop("endOfLifeDate", AAZStrType, ".end_of_life_date") - publishing_profile.set_prop("excludeFromLatest", AAZBoolType, ".exclude_from_latest") - publishing_profile.set_prop("replicaCount", AAZIntType, ".replica_count") - publishing_profile.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - publishing_profile.set_prop("targetRegions", AAZListType, ".target_regions") - - target_regions = _builder.get(".properties.publishingProfile.targetRegions") - if target_regions is not None: - target_regions.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.publishingProfile.targetRegions[]") - if _elements is not None: - _elements.set_prop("encryption", AAZObjectType, ".encryption") - _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("regionalReplicaCount", AAZIntType, ".regional_replica_count") - _elements.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - - encryption = _builder.get(".properties.publishingProfile.targetRegions[].encryption") - if encryption is not None: - encryption.set_prop("dataDiskImages", AAZListType, ".data_disk_images") - encryption.set_prop("osDiskImage", AAZObjectType, ".os_disk_image") - - data_disk_images = _builder.get(".properties.publishingProfile.targetRegions[].encryption.dataDiskImages") - if data_disk_images is not None: - data_disk_images.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.publishingProfile.targetRegions[].encryption.dataDiskImages[]") - if _elements is not None: - _elements.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - _elements.set_prop("lun", AAZIntType, ".lun", typ_kwargs={"flags": {"required": True}}) - - os_disk_image = _builder.get(".properties.publishingProfile.targetRegions[].encryption.osDiskImage") - if os_disk_image is not None: - os_disk_image.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - - storage_profile = _builder.get(".properties.storageProfile") - if storage_profile is not None: - storage_profile.set_prop("dataDiskImages", AAZListType, ".data_disk_images") - storage_profile.set_prop("osDiskImage", AAZObjectType, ".os_disk_image") - storage_profile.set_prop("source", AAZObjectType, ".source") - - data_disk_images = _builder.get(".properties.storageProfile.dataDiskImages") - if data_disk_images is not None: - data_disk_images.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.storageProfile.dataDiskImages[]") - if _elements is not None: - _elements.set_prop("hostCaching", AAZStrType, ".host_caching") - _elements.set_prop("lun", AAZIntType, ".lun", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_gallery_artifact_version_source_create(_elements.set_prop("source", AAZObjectType, ".source")) - - os_disk_image = _builder.get(".properties.storageProfile.osDiskImage") - if os_disk_image is not None: - os_disk_image.set_prop("hostCaching", AAZStrType, ".host_caching") - _CreateHelper._build_schema_gallery_artifact_version_source_create(os_disk_image.set_prop("source", AAZObjectType, ".source")) - - source = _builder.get(".properties.storageProfile.source") - if source is not None: - source.set_prop("id", AAZStrType, ".id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _CreateHelper._build_schema_gallery_image_version_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_gallery_artifact_version_source_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_gallery_artifact_version_source_read = None - - @classmethod - def _build_schema_gallery_artifact_version_source_read(cls, _schema): - if cls._schema_gallery_artifact_version_source_read is not None: - _schema.id = cls._schema_gallery_artifact_version_source_read.id - return - - cls._schema_gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read = AAZObjectType() - - gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read - gallery_artifact_version_source_read.id = AAZStrType() - - _schema.id = cls._schema_gallery_artifact_version_source_read.id - - _schema_gallery_image_version_read = None - - @classmethod - def _build_schema_gallery_image_version_read(cls, _schema): - if cls._schema_gallery_image_version_read is not None: - _schema.id = cls._schema_gallery_image_version_read.id - _schema.location = cls._schema_gallery_image_version_read.location - _schema.name = cls._schema_gallery_image_version_read.name - _schema.properties = cls._schema_gallery_image_version_read.properties - _schema.tags = cls._schema_gallery_image_version_read.tags - _schema.type = cls._schema_gallery_image_version_read.type - return - - cls._schema_gallery_image_version_read = _schema_gallery_image_version_read = AAZObjectType() - - gallery_image_version_read = _schema_gallery_image_version_read - gallery_image_version_read.id = AAZStrType( - flags={"read_only": True}, - ) - gallery_image_version_read.location = AAZStrType( - flags={"required": True}, - ) - gallery_image_version_read.name = AAZStrType( - flags={"read_only": True}, - ) - gallery_image_version_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - gallery_image_version_read.tags = AAZDictType() - gallery_image_version_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_gallery_image_version_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publishing_profile = AAZObjectType( - serialized_name="publishingProfile", - ) - properties.replication_status = AAZObjectType( - serialized_name="replicationStatus", - flags={"read_only": True}, - ) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - flags={"required": True}, - ) - - publishing_profile = _schema_gallery_image_version_read.properties.publishing_profile - publishing_profile.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - publishing_profile.exclude_from_latest = AAZBoolType( - serialized_name="excludeFromLatest", - ) - publishing_profile.published_date = AAZStrType( - serialized_name="publishedDate", - flags={"read_only": True}, - ) - publishing_profile.replica_count = AAZIntType( - serialized_name="replicaCount", - ) - publishing_profile.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - publishing_profile.target_regions = AAZListType( - serialized_name="targetRegions", - ) - - target_regions = _schema_gallery_image_version_read.properties.publishing_profile.target_regions - target_regions.Element = AAZObjectType() - - _element = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element - _element.encryption = AAZObjectType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.regional_replica_count = AAZIntType( - serialized_name="regionalReplicaCount", - ) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - encryption = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.encryption - encryption.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - encryption.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - - data_disk_images = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.encryption.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.encryption.data_disk_images.Element - _element.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - - os_disk_image = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.encryption.os_disk_image - os_disk_image.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - - replication_status = _schema_gallery_image_version_read.properties.replication_status - replication_status.aggregated_state = AAZStrType( - serialized_name="aggregatedState", - flags={"read_only": True}, - ) - replication_status.summary = AAZListType( - flags={"read_only": True}, - ) - - summary = _schema_gallery_image_version_read.properties.replication_status.summary - summary.Element = AAZObjectType() - - _element = _schema_gallery_image_version_read.properties.replication_status.summary.Element - _element.details = AAZStrType( - flags={"read_only": True}, - ) - _element.progress = AAZIntType( - flags={"read_only": True}, - ) - _element.region = AAZStrType( - flags={"read_only": True}, - ) - _element.state = AAZStrType( - flags={"read_only": True}, - ) - - storage_profile = _schema_gallery_image_version_read.properties.storage_profile - storage_profile.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - storage_profile.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - storage_profile.source = AAZObjectType() - cls._build_schema_gallery_artifact_version_source_read(storage_profile.source) - - data_disk_images = _schema_gallery_image_version_read.properties.storage_profile.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = _schema_gallery_image_version_read.properties.storage_profile.data_disk_images.Element - _element.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - _element.source = AAZObjectType() - cls._build_schema_gallery_artifact_version_source_read(_element.source) - - os_disk_image = _schema_gallery_image_version_read.properties.storage_profile.os_disk_image - os_disk_image.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - os_disk_image.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - os_disk_image.source = AAZObjectType() - cls._build_schema_gallery_artifact_version_source_read(os_disk_image.source) - - tags = _schema_gallery_image_version_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_gallery_image_version_read.id - _schema.location = cls._schema_gallery_image_version_read.location - _schema.name = cls._schema_gallery_image_version_read.name - _schema.properties = cls._schema_gallery_image_version_read.properties - _schema.tags = cls._schema_gallery_image_version_read.tags - _schema.type = cls._schema_gallery_image_version_read.type - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_delete.py deleted file mode 100644 index c46d38a0555..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_delete.py +++ /dev/null @@ -1,179 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-version delete", -) -class Delete(AAZCommand): - """Delete a gallery image version. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2019-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-name", "--gallery-image-definition"], - help="The name of the gallery image definition in which the Image Version resides.", - required=True, - id_part="child_name_1", - ) - _args_schema.gallery_image_version_name = AAZStrArg( - options=["-e", "--gallery-image-version", "--gallery-image-version-name"], - help="The name of the gallery image version to be deleted.", - required=True, - id_part="child_name_2", - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery in which the Image Definition resides.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.GalleryImageVersionsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class GalleryImageVersionsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryImageVersionName", self.ctx.args.gallery_image_version_name, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_list.py deleted file mode 100644 index 7c1932e9196..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_list.py +++ /dev/null @@ -1,357 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-version list", -) -class List(AAZCommand): - """List gallery image versions in a gallery image definition. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions", "2019-12-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-name", "--gallery-image-definition"], - help="Gallery image definition.", - required=True, - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="Gallery name.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.GalleryImageVersionsListByGalleryImage(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class GalleryImageVersionsListByGalleryImage(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publishing_profile = AAZObjectType( - serialized_name="publishingProfile", - ) - properties.replication_status = AAZObjectType( - serialized_name="replicationStatus", - flags={"read_only": True}, - ) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - flags={"required": True}, - ) - - publishing_profile = cls._schema_on_200.value.Element.properties.publishing_profile - publishing_profile.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - publishing_profile.exclude_from_latest = AAZBoolType( - serialized_name="excludeFromLatest", - ) - publishing_profile.published_date = AAZStrType( - serialized_name="publishedDate", - flags={"read_only": True}, - ) - publishing_profile.replica_count = AAZIntType( - serialized_name="replicaCount", - ) - publishing_profile.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - publishing_profile.target_regions = AAZListType( - serialized_name="targetRegions", - ) - - target_regions = cls._schema_on_200.value.Element.properties.publishing_profile.target_regions - target_regions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.publishing_profile.target_regions.Element - _element.encryption = AAZObjectType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.regional_replica_count = AAZIntType( - serialized_name="regionalReplicaCount", - ) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - encryption = cls._schema_on_200.value.Element.properties.publishing_profile.target_regions.Element.encryption - encryption.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - encryption.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - - data_disk_images = cls._schema_on_200.value.Element.properties.publishing_profile.target_regions.Element.encryption.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.publishing_profile.target_regions.Element.encryption.data_disk_images.Element - _element.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - - os_disk_image = cls._schema_on_200.value.Element.properties.publishing_profile.target_regions.Element.encryption.os_disk_image - os_disk_image.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - - replication_status = cls._schema_on_200.value.Element.properties.replication_status - replication_status.aggregated_state = AAZStrType( - serialized_name="aggregatedState", - flags={"read_only": True}, - ) - replication_status.summary = AAZListType( - flags={"read_only": True}, - ) - - summary = cls._schema_on_200.value.Element.properties.replication_status.summary - summary.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.replication_status.summary.Element - _element.details = AAZStrType( - flags={"read_only": True}, - ) - _element.progress = AAZIntType( - flags={"read_only": True}, - ) - _element.region = AAZStrType( - flags={"read_only": True}, - ) - _element.state = AAZStrType( - flags={"read_only": True}, - ) - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - storage_profile.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - storage_profile.source = AAZObjectType() - _ListHelper._build_schema_gallery_artifact_version_source_read(storage_profile.source) - - data_disk_images = cls._schema_on_200.value.Element.properties.storage_profile.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disk_images.Element - _element.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - _element.source = AAZObjectType() - _ListHelper._build_schema_gallery_artifact_version_source_read(_element.source) - - os_disk_image = cls._schema_on_200.value.Element.properties.storage_profile.os_disk_image - os_disk_image.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - os_disk_image.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - os_disk_image.source = AAZObjectType() - _ListHelper._build_schema_gallery_artifact_version_source_read(os_disk_image.source) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_gallery_artifact_version_source_read = None - - @classmethod - def _build_schema_gallery_artifact_version_source_read(cls, _schema): - if cls._schema_gallery_artifact_version_source_read is not None: - _schema.id = cls._schema_gallery_artifact_version_source_read.id - return - - cls._schema_gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read = AAZObjectType() - - gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read - gallery_artifact_version_source_read.id = AAZStrType() - - _schema.id = cls._schema_gallery_artifact_version_source_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_show.py deleted file mode 100644 index 799c16bdbc7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_show.py +++ /dev/null @@ -1,364 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-version show", -) -class Show(AAZCommand): - """Get information about a gallery image version. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2019-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-definition"], - help="The name of the gallery image definition in which the Image Version resides.", - required=True, - id_part="child_name_1", - ) - _args_schema.gallery_image_version_name = AAZStrArg( - options=["-e", "--gallery-image-version", "--gallery-image-version-name"], - help="The name of the gallery image version to be deleted.", - required=True, - id_part="child_name_2", - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery in which the Image Definition resides.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - enum={"ReplicationStatus": "ReplicationStatus"}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.GalleryImageVersionsGet(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 GalleryImageVersionsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryImageVersionName", self.ctx.args.gallery_image_version_name, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publishing_profile = AAZObjectType( - serialized_name="publishingProfile", - ) - properties.replication_status = AAZObjectType( - serialized_name="replicationStatus", - flags={"read_only": True}, - ) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - flags={"required": True}, - ) - - publishing_profile = cls._schema_on_200.properties.publishing_profile - publishing_profile.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - publishing_profile.exclude_from_latest = AAZBoolType( - serialized_name="excludeFromLatest", - ) - publishing_profile.published_date = AAZStrType( - serialized_name="publishedDate", - flags={"read_only": True}, - ) - publishing_profile.replica_count = AAZIntType( - serialized_name="replicaCount", - ) - publishing_profile.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - publishing_profile.target_regions = AAZListType( - serialized_name="targetRegions", - ) - - target_regions = cls._schema_on_200.properties.publishing_profile.target_regions - target_regions.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.publishing_profile.target_regions.Element - _element.encryption = AAZObjectType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.regional_replica_count = AAZIntType( - serialized_name="regionalReplicaCount", - ) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - encryption = cls._schema_on_200.properties.publishing_profile.target_regions.Element.encryption - encryption.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - encryption.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - - data_disk_images = cls._schema_on_200.properties.publishing_profile.target_regions.Element.encryption.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.publishing_profile.target_regions.Element.encryption.data_disk_images.Element - _element.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - - os_disk_image = cls._schema_on_200.properties.publishing_profile.target_regions.Element.encryption.os_disk_image - os_disk_image.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - - replication_status = cls._schema_on_200.properties.replication_status - replication_status.aggregated_state = AAZStrType( - serialized_name="aggregatedState", - flags={"read_only": True}, - ) - replication_status.summary = AAZListType( - flags={"read_only": True}, - ) - - summary = cls._schema_on_200.properties.replication_status.summary - summary.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.replication_status.summary.Element - _element.details = AAZStrType( - flags={"read_only": True}, - ) - _element.progress = AAZIntType( - flags={"read_only": True}, - ) - _element.region = AAZStrType( - flags={"read_only": True}, - ) - _element.state = AAZStrType( - flags={"read_only": True}, - ) - - storage_profile = cls._schema_on_200.properties.storage_profile - storage_profile.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - storage_profile.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - storage_profile.source = AAZObjectType() - _ShowHelper._build_schema_gallery_artifact_version_source_read(storage_profile.source) - - data_disk_images = cls._schema_on_200.properties.storage_profile.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.storage_profile.data_disk_images.Element - _element.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - _element.source = AAZObjectType() - _ShowHelper._build_schema_gallery_artifact_version_source_read(_element.source) - - os_disk_image = cls._schema_on_200.properties.storage_profile.os_disk_image - os_disk_image.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - os_disk_image.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - os_disk_image.source = AAZObjectType() - _ShowHelper._build_schema_gallery_artifact_version_source_read(os_disk_image.source) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_gallery_artifact_version_source_read = None - - @classmethod - def _build_schema_gallery_artifact_version_source_read(cls, _schema): - if cls._schema_gallery_artifact_version_source_read is not None: - _schema.id = cls._schema_gallery_artifact_version_source_read.id - return - - cls._schema_gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read = AAZObjectType() - - gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read - gallery_artifact_version_source_read.id = AAZStrType() - - _schema.id = cls._schema_gallery_artifact_version_source_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_update.py deleted file mode 100644 index 430f3c03f02..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_update.py +++ /dev/null @@ -1,821 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Update(AAZCommand): - """Update a gallery image version. - """ - - _aaz_info = { - "version": "2019-12-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2019-12-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-name", "--gallery-image-definition"], - help="The name of the gallery image definition in which the Image Version resides.", - required=True, - id_part="child_name_1", - ) - _args_schema.gallery_image_version_name = AAZStrArg( - options=["-e", "--gallery-image-version", "--gallery-image-version-name"], - help="The name of the gallery image version to be deleted.", - required=True, - id_part="child_name_2", - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery in which the Image Definition resides.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "GalleryImageVersion" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="GalleryImageVersion", - help="Resource location", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="GalleryImageVersion", - help="Resource tags", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.publishing_profile = AAZObjectArg( - options=["--publishing-profile"], - arg_group="Properties", - help="The publishing profile of a gallery image Version.", - nullable=True, - ) - _args_schema.storage_profile = AAZObjectArg( - options=["--storage-profile"], - arg_group="Properties", - help="This is the storage profile of a Gallery Image Version.", - ) - - publishing_profile = cls._args_schema.publishing_profile - publishing_profile.end_of_life_date = AAZDateTimeArg( - options=["end-of-life-date"], - help="The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property is updatable.", - nullable=True, - ) - publishing_profile.exclude_from_latest = AAZBoolArg( - options=["exclude-from-latest"], - help="If set to true, Virtual Machines deployed from the latest version of the Image Definition won't use this Image Version.", - nullable=True, - ) - publishing_profile.replica_count = AAZIntArg( - options=["replica-count"], - help="The number of replicas of the Image Version to be created per region. This property would take effect for a region when regionalReplicaCount is not specified. This property is updatable.", - nullable=True, - ) - publishing_profile.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type to be used to store the image. This property is not updatable.", - nullable=True, - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"}, - ) - publishing_profile.target_regions = AAZListArg( - options=["target-regions"], - help="The target regions where the Image Version is going to be replicated to. This property is updatable.", - nullable=True, - ) - - target_regions = cls._args_schema.publishing_profile.target_regions - target_regions.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.publishing_profile.target_regions.Element - _element.encryption = AAZObjectArg( - options=["encryption"], - help="Optional. Allows users to provide customer managed keys for encrypting the OS and data disks in the gallery artifact.", - nullable=True, - ) - _element.name = AAZStrArg( - options=["name"], - help="The name of the region.", - ) - _element.regional_replica_count = AAZIntArg( - options=["regional-replica-count"], - help="The number of replicas of the Image Version to be created per region. This property is updatable.", - nullable=True, - ) - _element.storage_account_type = AAZStrArg( - options=["storage-account-type"], - help="Specifies the storage account type to be used to store the image. This property is not updatable.", - nullable=True, - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"}, - ) - - encryption = cls._args_schema.publishing_profile.target_regions.Element.encryption - encryption.data_disk_images = AAZListArg( - options=["data-disk-images"], - help="A list of encryption specifications for data disk images.", - nullable=True, - ) - encryption.os_disk_image = AAZObjectArg( - options=["os-disk-image"], - help="Contains encryption settings for an OS disk image.", - nullable=True, - ) - - data_disk_images = cls._args_schema.publishing_profile.target_regions.Element.encryption.data_disk_images - data_disk_images.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.publishing_profile.target_regions.Element.encryption.data_disk_images.Element - _element.disk_encryption_set_id = AAZStrArg( - options=["disk-encryption-set-id"], - help="A relative URI containing the resource ID of the disk encryption set.", - nullable=True, - ) - _element.lun = AAZIntArg( - options=["lun"], - help="This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine.", - ) - - os_disk_image = cls._args_schema.publishing_profile.target_regions.Element.encryption.os_disk_image - os_disk_image.disk_encryption_set_id = AAZStrArg( - options=["disk-encryption-set-id"], - help="A relative URI containing the resource ID of the disk encryption set.", - nullable=True, - ) - - storage_profile = cls._args_schema.storage_profile - storage_profile.data_disk_images = AAZListArg( - options=["data-disk-images"], - help="A list of data disk images.", - nullable=True, - ) - storage_profile.os_disk_image = AAZObjectArg( - options=["os-disk-image"], - help="This is the OS disk image.", - nullable=True, - ) - storage_profile.source = AAZObjectArg( - options=["source"], - help="The source of the gallery artifact version.", - nullable=True, - ) - - data_disk_images = cls._args_schema.storage_profile.data_disk_images - data_disk_images.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.storage_profile.data_disk_images.Element - _element.host_caching = AAZStrArg( - options=["host-caching"], - help="The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'", - nullable=True, - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - _element.lun = AAZIntArg( - options=["lun"], - help="This property specifies the logical unit number of the data disk. This value is used to identify data disks within the Virtual Machine and therefore must be unique for each data disk attached to the Virtual Machine.", - ) - _element.source = AAZObjectArg( - options=["source"], - nullable=True, - ) - cls._build_args_gallery_artifact_version_source_update(_element.source) - - os_disk_image = cls._args_schema.storage_profile.os_disk_image - os_disk_image.host_caching = AAZStrArg( - options=["host-caching"], - help="The host caching of the disk. Valid values are 'None', 'ReadOnly', and 'ReadWrite'", - nullable=True, - enum={"None": "None", "ReadOnly": "ReadOnly", "ReadWrite": "ReadWrite"}, - ) - os_disk_image.source = AAZObjectArg( - options=["source"], - help="The source for the disk image.", - nullable=True, - ) - cls._build_args_gallery_artifact_version_source_update(os_disk_image.source) - - source = cls._args_schema.storage_profile.source - source.id = AAZStrArg( - options=["id"], - help="The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource.", - nullable=True, - ) - return cls._args_schema - - _args_gallery_artifact_version_source_update = None - - @classmethod - def _build_args_gallery_artifact_version_source_update(cls, _schema): - if cls._args_gallery_artifact_version_source_update is not None: - _schema.id = cls._args_gallery_artifact_version_source_update.id - return - - cls._args_gallery_artifact_version_source_update = AAZObjectArg( - nullable=True, - ) - - gallery_artifact_version_source_update = cls._args_gallery_artifact_version_source_update - gallery_artifact_version_source_update.id = AAZStrArg( - options=["id"], - help="The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, or user image.", - nullable=True, - ) - - _schema.id = cls._args_gallery_artifact_version_source_update.id - - def _execute_operations(self): - self.pre_operations() - self.GalleryImageVersionsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.GalleryImageVersionsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class GalleryImageVersionsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryImageVersionName", self.ctx.args.gallery_image_version_name, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_gallery_image_version_read(cls._schema_on_200) - - return cls._schema_on_200 - - class GalleryImageVersionsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200, 201]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200_201, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryImageVersionName", self.ctx.args.gallery_image_version_name, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-12-01", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_gallery_image_version_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("publishingProfile", AAZObjectType, ".publishing_profile") - properties.set_prop("storageProfile", AAZObjectType, ".storage_profile", typ_kwargs={"flags": {"required": True}}) - - publishing_profile = _builder.get(".properties.publishingProfile") - if publishing_profile is not None: - publishing_profile.set_prop("endOfLifeDate", AAZStrType, ".end_of_life_date") - publishing_profile.set_prop("excludeFromLatest", AAZBoolType, ".exclude_from_latest") - publishing_profile.set_prop("replicaCount", AAZIntType, ".replica_count") - publishing_profile.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - publishing_profile.set_prop("targetRegions", AAZListType, ".target_regions") - - target_regions = _builder.get(".properties.publishingProfile.targetRegions") - if target_regions is not None: - target_regions.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.publishingProfile.targetRegions[]") - if _elements is not None: - _elements.set_prop("encryption", AAZObjectType, ".encryption") - _elements.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) - _elements.set_prop("regionalReplicaCount", AAZIntType, ".regional_replica_count") - _elements.set_prop("storageAccountType", AAZStrType, ".storage_account_type") - - encryption = _builder.get(".properties.publishingProfile.targetRegions[].encryption") - if encryption is not None: - encryption.set_prop("dataDiskImages", AAZListType, ".data_disk_images") - encryption.set_prop("osDiskImage", AAZObjectType, ".os_disk_image") - - data_disk_images = _builder.get(".properties.publishingProfile.targetRegions[].encryption.dataDiskImages") - if data_disk_images is not None: - data_disk_images.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.publishingProfile.targetRegions[].encryption.dataDiskImages[]") - if _elements is not None: - _elements.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - _elements.set_prop("lun", AAZIntType, ".lun", typ_kwargs={"flags": {"required": True}}) - - os_disk_image = _builder.get(".properties.publishingProfile.targetRegions[].encryption.osDiskImage") - if os_disk_image is not None: - os_disk_image.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - - storage_profile = _builder.get(".properties.storageProfile") - if storage_profile is not None: - storage_profile.set_prop("dataDiskImages", AAZListType, ".data_disk_images") - storage_profile.set_prop("osDiskImage", AAZObjectType, ".os_disk_image") - storage_profile.set_prop("source", AAZObjectType, ".source") - - data_disk_images = _builder.get(".properties.storageProfile.dataDiskImages") - if data_disk_images is not None: - data_disk_images.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.storageProfile.dataDiskImages[]") - if _elements is not None: - _elements.set_prop("hostCaching", AAZStrType, ".host_caching") - _elements.set_prop("lun", AAZIntType, ".lun", typ_kwargs={"flags": {"required": True}}) - _UpdateHelper._build_schema_gallery_artifact_version_source_update(_elements.set_prop("source", AAZObjectType, ".source")) - - os_disk_image = _builder.get(".properties.storageProfile.osDiskImage") - if os_disk_image is not None: - os_disk_image.set_prop("hostCaching", AAZStrType, ".host_caching") - _UpdateHelper._build_schema_gallery_artifact_version_source_update(os_disk_image.set_prop("source", AAZObjectType, ".source")) - - source = _builder.get(".properties.storageProfile.source") - if source is not None: - source.set_prop("id", AAZStrType, ".id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_gallery_artifact_version_source_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_gallery_artifact_version_source_read = None - - @classmethod - def _build_schema_gallery_artifact_version_source_read(cls, _schema): - if cls._schema_gallery_artifact_version_source_read is not None: - _schema.id = cls._schema_gallery_artifact_version_source_read.id - return - - cls._schema_gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read = AAZObjectType() - - gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read - gallery_artifact_version_source_read.id = AAZStrType() - - _schema.id = cls._schema_gallery_artifact_version_source_read.id - - _schema_gallery_image_version_read = None - - @classmethod - def _build_schema_gallery_image_version_read(cls, _schema): - if cls._schema_gallery_image_version_read is not None: - _schema.id = cls._schema_gallery_image_version_read.id - _schema.location = cls._schema_gallery_image_version_read.location - _schema.name = cls._schema_gallery_image_version_read.name - _schema.properties = cls._schema_gallery_image_version_read.properties - _schema.tags = cls._schema_gallery_image_version_read.tags - _schema.type = cls._schema_gallery_image_version_read.type - return - - cls._schema_gallery_image_version_read = _schema_gallery_image_version_read = AAZObjectType() - - gallery_image_version_read = _schema_gallery_image_version_read - gallery_image_version_read.id = AAZStrType( - flags={"read_only": True}, - ) - gallery_image_version_read.location = AAZStrType( - flags={"required": True}, - ) - gallery_image_version_read.name = AAZStrType( - flags={"read_only": True}, - ) - gallery_image_version_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - gallery_image_version_read.tags = AAZDictType() - gallery_image_version_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_gallery_image_version_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publishing_profile = AAZObjectType( - serialized_name="publishingProfile", - ) - properties.replication_status = AAZObjectType( - serialized_name="replicationStatus", - flags={"read_only": True}, - ) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - flags={"required": True}, - ) - - publishing_profile = _schema_gallery_image_version_read.properties.publishing_profile - publishing_profile.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - publishing_profile.exclude_from_latest = AAZBoolType( - serialized_name="excludeFromLatest", - ) - publishing_profile.published_date = AAZStrType( - serialized_name="publishedDate", - flags={"read_only": True}, - ) - publishing_profile.replica_count = AAZIntType( - serialized_name="replicaCount", - ) - publishing_profile.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - publishing_profile.target_regions = AAZListType( - serialized_name="targetRegions", - ) - - target_regions = _schema_gallery_image_version_read.properties.publishing_profile.target_regions - target_regions.Element = AAZObjectType() - - _element = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element - _element.encryption = AAZObjectType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.regional_replica_count = AAZIntType( - serialized_name="regionalReplicaCount", - ) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - encryption = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.encryption - encryption.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - encryption.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - - data_disk_images = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.encryption.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.encryption.data_disk_images.Element - _element.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - - os_disk_image = _schema_gallery_image_version_read.properties.publishing_profile.target_regions.Element.encryption.os_disk_image - os_disk_image.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - - replication_status = _schema_gallery_image_version_read.properties.replication_status - replication_status.aggregated_state = AAZStrType( - serialized_name="aggregatedState", - flags={"read_only": True}, - ) - replication_status.summary = AAZListType( - flags={"read_only": True}, - ) - - summary = _schema_gallery_image_version_read.properties.replication_status.summary - summary.Element = AAZObjectType() - - _element = _schema_gallery_image_version_read.properties.replication_status.summary.Element - _element.details = AAZStrType( - flags={"read_only": True}, - ) - _element.progress = AAZIntType( - flags={"read_only": True}, - ) - _element.region = AAZStrType( - flags={"read_only": True}, - ) - _element.state = AAZStrType( - flags={"read_only": True}, - ) - - storage_profile = _schema_gallery_image_version_read.properties.storage_profile - storage_profile.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - storage_profile.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - storage_profile.source = AAZObjectType() - cls._build_schema_gallery_artifact_version_source_read(storage_profile.source) - - data_disk_images = _schema_gallery_image_version_read.properties.storage_profile.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = _schema_gallery_image_version_read.properties.storage_profile.data_disk_images.Element - _element.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - _element.source = AAZObjectType() - cls._build_schema_gallery_artifact_version_source_read(_element.source) - - os_disk_image = _schema_gallery_image_version_read.properties.storage_profile.os_disk_image - os_disk_image.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - os_disk_image.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - os_disk_image.source = AAZObjectType() - cls._build_schema_gallery_artifact_version_source_read(os_disk_image.source) - - tags = _schema_gallery_image_version_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_gallery_image_version_read.id - _schema.location = cls._schema_gallery_image_version_read.location - _schema.name = cls._schema_gallery_image_version_read.name - _schema.properties = cls._schema_gallery_image_version_read.properties - _schema.tags = cls._schema_gallery_image_version_read.tags - _schema.type = cls._schema_gallery_image_version_read.type - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_wait.py deleted file mode 100644 index 5266c48d7e8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/sig/image_version/_wait.py +++ /dev/null @@ -1,363 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "sig image-version wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/galleries/{}/images/{}/versions/{}", "2019-12-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.gallery_image_definition = AAZStrArg( - options=["-i", "--gallery-image-definition"], - help="The name of the gallery image definition in which the Image Version resides.", - required=True, - id_part="child_name_1", - ) - _args_schema.gallery_image_version_name = AAZStrArg( - options=["-e", "--gallery-image-version", "--gallery-image-version-name"], - help="The name of the gallery image version to be deleted.", - required=True, - id_part="child_name_2", - ) - _args_schema.gallery_name = AAZStrArg( - options=["-r", "--gallery-name"], - help="The name of the Shared Image Gallery in which the Image Definition resides.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - enum={"ReplicationStatus": "ReplicationStatus"}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.GalleryImageVersionsGet(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=False) - return result - - class GalleryImageVersionsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "galleryImageName", self.ctx.args.gallery_image_definition, - required=True, - ), - **self.serialize_url_param( - "galleryImageVersionName", self.ctx.args.gallery_image_version_name, - required=True, - ), - **self.serialize_url_param( - "galleryName", self.ctx.args.gallery_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2019-12-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publishing_profile = AAZObjectType( - serialized_name="publishingProfile", - ) - properties.replication_status = AAZObjectType( - serialized_name="replicationStatus", - flags={"read_only": True}, - ) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - flags={"required": True}, - ) - - publishing_profile = cls._schema_on_200.properties.publishing_profile - publishing_profile.end_of_life_date = AAZStrType( - serialized_name="endOfLifeDate", - ) - publishing_profile.exclude_from_latest = AAZBoolType( - serialized_name="excludeFromLatest", - ) - publishing_profile.published_date = AAZStrType( - serialized_name="publishedDate", - flags={"read_only": True}, - ) - publishing_profile.replica_count = AAZIntType( - serialized_name="replicaCount", - ) - publishing_profile.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - publishing_profile.target_regions = AAZListType( - serialized_name="targetRegions", - ) - - target_regions = cls._schema_on_200.properties.publishing_profile.target_regions - target_regions.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.publishing_profile.target_regions.Element - _element.encryption = AAZObjectType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.regional_replica_count = AAZIntType( - serialized_name="regionalReplicaCount", - ) - _element.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - encryption = cls._schema_on_200.properties.publishing_profile.target_regions.Element.encryption - encryption.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - encryption.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - - data_disk_images = cls._schema_on_200.properties.publishing_profile.target_regions.Element.encryption.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.publishing_profile.target_regions.Element.encryption.data_disk_images.Element - _element.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - - os_disk_image = cls._schema_on_200.properties.publishing_profile.target_regions.Element.encryption.os_disk_image - os_disk_image.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - - replication_status = cls._schema_on_200.properties.replication_status - replication_status.aggregated_state = AAZStrType( - serialized_name="aggregatedState", - flags={"read_only": True}, - ) - replication_status.summary = AAZListType( - flags={"read_only": True}, - ) - - summary = cls._schema_on_200.properties.replication_status.summary - summary.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.replication_status.summary.Element - _element.details = AAZStrType( - flags={"read_only": True}, - ) - _element.progress = AAZIntType( - flags={"read_only": True}, - ) - _element.region = AAZStrType( - flags={"read_only": True}, - ) - _element.state = AAZStrType( - flags={"read_only": True}, - ) - - storage_profile = cls._schema_on_200.properties.storage_profile - storage_profile.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - storage_profile.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - storage_profile.source = AAZObjectType() - _WaitHelper._build_schema_gallery_artifact_version_source_read(storage_profile.source) - - data_disk_images = cls._schema_on_200.properties.storage_profile.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.storage_profile.data_disk_images.Element - _element.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - _element.source = AAZObjectType() - _WaitHelper._build_schema_gallery_artifact_version_source_read(_element.source) - - os_disk_image = cls._schema_on_200.properties.storage_profile.os_disk_image - os_disk_image.host_caching = AAZStrType( - serialized_name="hostCaching", - ) - os_disk_image.size_in_gb = AAZIntType( - serialized_name="sizeInGB", - flags={"read_only": True}, - ) - os_disk_image.source = AAZObjectType() - _WaitHelper._build_schema_gallery_artifact_version_source_read(os_disk_image.source) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_gallery_artifact_version_source_read = None - - @classmethod - def _build_schema_gallery_artifact_version_source_read(cls, _schema): - if cls._schema_gallery_artifact_version_source_read is not None: - _schema.id = cls._schema_gallery_artifact_version_source_read.id - return - - cls._schema_gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read = AAZObjectType() - - gallery_artifact_version_source_read = _schema_gallery_artifact_version_source_read - gallery_artifact_version_source_read.id = AAZStrType() - - _schema.id = cls._schema_gallery_artifact_version_source_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/__cmd_group.py deleted file mode 100644 index f4c2f2afe19..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot", -) -class __CMDGroup(AAZCommandGroup): - """Manage point-in-time copies of managed disks, native blobs, or other snapshots. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/__init__.py deleted file mode 100644 index 59700973595..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._grant_access import * -from ._list import * -from ._revoke_access import * -from ._show import * -from ._update import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_create.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_create.py deleted file mode 100644 index 390408c0384..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_create.py +++ /dev/null @@ -1,643 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot create", -) -class Create(AAZCommand): - """Create a snapshot. - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.creation_data = AAZObjectArg( - options=["--creation-data"], - arg_group="Properties", - help="Disk source information. CreationData information cannot be changed after the disk has been created.", - ) - _args_schema.disk_size_gb = AAZIntArg( - options=["--disk-size-gb"], - arg_group="Properties", - help="If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.", - ) - _args_schema.encryption = AAZObjectArg( - options=["--encryption"], - arg_group="Properties", - help="Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.", - ) - _args_schema.encryption_settings_collection = AAZObjectArg( - options=["--encryption-settings-collection"], - arg_group="Properties", - help="Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.", - ) - _args_schema.hyper_v_generation = AAZStrArg( - options=["--hyper-v-generation"], - arg_group="Properties", - help="The hypervisor generation of the Virtual Machine. Applicable to OS disks only.", - enum={"V1": "V1", "V2": "V2"}, - ) - _args_schema.incremental = AAZBoolArg( - options=["--incremental"], - arg_group="Properties", - help="Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.", - ) - _args_schema.os_type = AAZStrArg( - options=["--os-type"], - arg_group="Properties", - help="The Operating System type.", - enum={"Linux": "Linux", "Windows": "Windows"}, - ) - - creation_data = cls._args_schema.creation_data - creation_data.create_option = AAZStrArg( - options=["create-option"], - help="This enumerates the possible sources of a disk's creation.", - required=True, - enum={"Attach": "Attach", "Copy": "Copy", "Empty": "Empty", "FromImage": "FromImage", "Import": "Import", "Restore": "Restore", "Upload": "Upload"}, - ) - creation_data.image_reference = AAZObjectArg( - options=["image-reference"], - help="Disk source information for PIR or user images.", - ) - creation_data.source_resource_id = AAZStrArg( - options=["source-resource-id"], - help="If createOption is Copy, this is the ARM id of the source snapshot or disk.", - ) - creation_data.source_uri = AAZStrArg( - options=["source-uri"], - help="If createOption is Import, this is the URI of a blob to be imported into a managed disk.", - ) - creation_data.storage_account_id = AAZStrArg( - options=["storage-account-id"], - help="Required if createOption is Import. The Azure Resource Manager identifier of the storage account containing the blob to import as a disk.", - ) - creation_data.upload_size_bytes = AAZIntArg( - options=["upload-size-bytes"], - help="If createOption is Upload, this is the size of the contents of the upload including the VHD footer. This value should be between 20972032 (20 MiB + 512 bytes for the VHD footer) and 35183298347520 bytes (32 TiB + 512 bytes for the VHD footer).", - ) - - image_reference = cls._args_schema.creation_data.image_reference - image_reference.id = AAZStrArg( - options=["id"], - help="A relative uri containing either a Platform Image Repository or user image reference.", - ) - image_reference.lun = AAZIntArg( - options=["lun"], - help="If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null.", - ) - - encryption = cls._args_schema.encryption - encryption.disk_encryption_set_id = AAZStrArg( - options=["disk-encryption-set-id"], - help="ResourceId of the disk encryption set to use for enabling encryption at rest.", - ) - encryption.type = AAZStrArg( - options=["type"], - help="The type of key used to encrypt the data of the disk.", - enum={"EncryptionAtRestWithCustomerKey": "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformKey": "EncryptionAtRestWithPlatformKey"}, - ) - - encryption_settings_collection = cls._args_schema.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolArg( - options=["enabled"], - help="Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged.", - required=True, - ) - encryption_settings_collection.encryption_settings = AAZListArg( - options=["encryption-settings"], - help="A collection of encryption settings, one for each disk volume.", - ) - encryption_settings_collection.encryption_settings_version = AAZStrArg( - options=["encryption-settings-version"], - help="Describes what type of encryption is used for the disks. Once this field is set, it cannot be overwritten. '1.0' corresponds to Azure Disk Encryption with AAD app.'1.1' corresponds to Azure Disk Encryption.", - ) - - encryption_settings = cls._args_schema.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectArg() - - _element = cls._args_schema.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectArg( - options=["disk-encryption-key"], - help="Key Vault Secret Url and vault id of the disk encryption key", - ) - _element.key_encryption_key = AAZObjectArg( - options=["key-encryption-key"], - help="Key Vault Key Url and vault id of the key encryption key. KeyEncryptionKey is optional and when provided is used to unwrap the disk encryption key.", - ) - - disk_encryption_key = cls._args_schema.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrArg( - options=["secret-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - disk_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(disk_encryption_key.source_vault) - - key_encryption_key = cls._args_schema.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrArg( - options=["key-url"], - help="Url pointing to a key or secret in KeyVault", - required=True, - ) - key_encryption_key.source_vault = AAZObjectArg( - options=["source-vault"], - help="Resource id of the KeyVault containing the key or secret", - required=True, - ) - cls._build_args_source_vault_create(key_encryption_key.source_vault) - - # define Arg Group "Snapshot" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Snapshot", - help="Resource location", - required=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - arg_group="Snapshot", - help="The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. This is an optional parameter for incremental snapshot and the default behavior is the SKU will be set to the same sku as the previous snapshot", - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Snapshot", - help="Resource tags", - ) - - sku = cls._args_schema.sku - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"}, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - _args_source_vault_create = None - - @classmethod - def _build_args_source_vault_create(cls, _schema): - if cls._args_source_vault_create is not None: - _schema.id = cls._args_source_vault_create.id - return - - cls._args_source_vault_create = AAZObjectArg() - - source_vault_create = cls._args_source_vault_create - source_vault_create.id = AAZStrArg( - options=["id"], - help="Resource Id", - ) - - _schema.id = cls._args_source_vault_create.id - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsCreateOrUpdate(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 SnapshotsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2019-07-01", - 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("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("creationData", AAZObjectType, ".creation_data", typ_kwargs={"flags": {"required": True}}) - properties.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb") - properties.set_prop("encryption", AAZObjectType, ".encryption") - properties.set_prop("encryptionSettingsCollection", AAZObjectType, ".encryption_settings_collection") - properties.set_prop("hyperVGeneration", AAZStrType, ".hyper_v_generation") - properties.set_prop("incremental", AAZBoolType, ".incremental") - properties.set_prop("osType", AAZStrType, ".os_type") - - creation_data = _builder.get(".properties.creationData") - if creation_data is not None: - creation_data.set_prop("createOption", AAZStrType, ".create_option", typ_kwargs={"flags": {"required": True}}) - creation_data.set_prop("imageReference", AAZObjectType, ".image_reference") - creation_data.set_prop("sourceResourceId", AAZStrType, ".source_resource_id") - creation_data.set_prop("sourceUri", AAZStrType, ".source_uri") - creation_data.set_prop("storageAccountId", AAZStrType, ".storage_account_id") - creation_data.set_prop("uploadSizeBytes", AAZIntType, ".upload_size_bytes") - - image_reference = _builder.get(".properties.creationData.imageReference") - if image_reference is not None: - image_reference.set_prop("id", AAZStrType, ".id") - image_reference.set_prop("lun", AAZIntType, ".lun") - - encryption = _builder.get(".properties.encryption") - if encryption is not None: - encryption.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - encryption.set_prop("type", AAZStrType, ".type") - - encryption_settings_collection = _builder.get(".properties.encryptionSettingsCollection") - if encryption_settings_collection is not None: - encryption_settings_collection.set_prop("enabled", AAZBoolType, ".enabled", typ_kwargs={"flags": {"required": True}}) - encryption_settings_collection.set_prop("encryptionSettings", AAZListType, ".encryption_settings") - encryption_settings_collection.set_prop("encryptionSettingsVersion", AAZStrType, ".encryption_settings_version") - - encryption_settings = _builder.get(".properties.encryptionSettingsCollection.encryptionSettings") - if encryption_settings is not None: - encryption_settings.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.encryptionSettingsCollection.encryptionSettings[]") - if _elements is not None: - _elements.set_prop("diskEncryptionKey", AAZObjectType, ".disk_encryption_key") - _elements.set_prop("keyEncryptionKey", AAZObjectType, ".key_encryption_key") - - disk_encryption_key = _builder.get(".properties.encryptionSettingsCollection.encryptionSettings[].diskEncryptionKey") - if disk_encryption_key is not None: - disk_encryption_key.set_prop("secretUrl", AAZStrType, ".secret_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(disk_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - key_encryption_key = _builder.get(".properties.encryptionSettingsCollection.encryptionSettings[].keyEncryptionKey") - if key_encryption_key is not None: - key_encryption_key.set_prop("keyUrl", AAZStrType, ".key_url", typ_kwargs={"flags": {"required": True}}) - _CreateHelper._build_schema_source_vault_create(key_encryption_key.set_prop("sourceVault", AAZObjectType, ".source_vault", typ_kwargs={"flags": {"required": True}})) - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".name") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - 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() - _CreateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_source_vault_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_snapshot_read = None - - @classmethod - def _build_schema_snapshot_read(cls, _schema): - if cls._schema_snapshot_read is not None: - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - return - - cls._schema_snapshot_read = _schema_snapshot_read = AAZObjectType() - - snapshot_read = _schema_snapshot_read - snapshot_read.id = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.location = AAZStrType( - flags={"required": True}, - ) - snapshot_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - snapshot_read.name = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - snapshot_read.sku = AAZObjectType() - snapshot_read.tags = AAZDictType() - snapshot_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_snapshot_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.incremental = AAZBoolType() - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = _schema_snapshot_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = _schema_snapshot_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption = _schema_snapshot_read.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = _schema_snapshot_read.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = _schema_snapshot_read.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = _schema_snapshot_read.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_snapshot_read.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_snapshot_read.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_snapshot_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_snapshot_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_delete.py deleted file mode 100644 index 66ea7c9ca45..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_delete.py +++ /dev/null @@ -1,159 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot delete", -) -class Delete(AAZCommand): - """Delete a snapshot. - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class SnapshotsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_grant_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_grant_access.py deleted file mode 100644 index 8904a9f35b6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_grant_access.py +++ /dev/null @@ -1,221 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot grant-access", -) -class GrantAccess(AAZCommand): - """Grant read access to a snapshot. - - :example: Grant read access to a snapshot. - az snapshot grant-access --duration-in-seconds 3600 --name MySnapshot --resource-group MyResourceGroup - - :example: Grant read access to a snapshot with specifying the file format. - az snapshot grant-access --duration-in-seconds 3600 --name MySnapshot --resource-group MyResourceGroup --file-format VHDX - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}/begingetaccess", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - - # define Arg Group "GrantAccessData" - - _args_schema = cls._args_schema - _args_schema.access_level = AAZStrArg( - options=["--access", "--access-level"], - arg_group="GrantAccessData", - help="Access level.", - required=True, - default="Read", - enum={"Read": "Read", "Write": "Write"}, - ) - _args_schema.duration_in_seconds = AAZIntArg( - options=["--duration-in-seconds"], - arg_group="GrantAccessData", - help="Time duration in seconds until the SAS access expires.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsGrantAccess(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 SnapshotsGrantAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2019-07-01", - 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("access", AAZStrType, ".access_level", typ_kwargs={"flags": {"required": True}}) - _builder.set_prop("durationInSeconds", AAZIntType, ".duration_in_seconds", 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.access_sas = AAZStrType( - serialized_name="accessSAS", - flags={"read_only": True}, - ) - - return cls._schema_on_200 - - -class _GrantAccessHelper: - """Helper class for GrantAccess""" - - -__all__ = ["GrantAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_list.py deleted file mode 100644 index 2418497114c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_list.py +++ /dev/null @@ -1,568 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot list", -) -class List(AAZCommand): - """List snapshots under a resource group. - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/snapshots", "2019-07-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots", "2019-07-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.SnapshotsList(ctx=self.ctx)() - if condition_1: - self.SnapshotsListByResourceGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class SnapshotsList(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.Compute/snapshots", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.incremental = AAZBoolType() - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption = cls._schema_on_200.value.Element.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType( - flags={"required": True}, - ) - - encryption_settings_collection = cls._schema_on_200.value.Element.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class SnapshotsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.incremental = AAZBoolType() - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.value.Element.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = cls._schema_on_200.value.Element.properties.creation_data.image_reference - image_reference.id = AAZStrType( - flags={"required": True}, - ) - image_reference.lun = AAZIntType() - - encryption = cls._schema_on_200.value.Element.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType( - flags={"required": True}, - ) - - encryption_settings_collection = cls._schema_on_200.value.Element.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.value.Element.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ListHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.value.Element.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_revoke_access.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_revoke_access.py deleted file mode 100644 index 6e96550582d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_revoke_access.py +++ /dev/null @@ -1,150 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot revoke-access", -) -class RevokeAccess(AAZCommand): - """Revoke access to a snapshot. - - :example: Revoke read access to a snapshot. - az snapshot revoke-access --name MySnapshot --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}/endgetaccess", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.SnapshotsRevokeAccess(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class SnapshotsRevokeAccess(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _RevokeAccessHelper: - """Helper class for RevokeAccess""" - - -__all__ = ["RevokeAccess"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_show.py deleted file mode 100644 index f264e33c358..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_show.py +++ /dev/null @@ -1,321 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot show", -) -class Show(AAZCommand): - """Get information about a snapshot. - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2019-07-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(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 SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.incremental = AAZBoolType() - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption = cls._schema_on_200.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = cls._schema_on_200.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _ShowHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_update.py deleted file mode 100644 index d7d19a890ee..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_update.py +++ /dev/null @@ -1,570 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot update", -) -class Update(AAZCommand): - """Update a snapshot. - - :example: Update a snapshot and associate it with a disk access resource. - az snapshot update --name MySnapshot --resource-group MyResourceGroup --network-access-policy AllowPrivate --disk-access MyDiskAccessID - - :example: Update a snapshot. - az snapshot update --name MySnapshot --resource-group MyResourceGroup --subscription MySubscription - """ - - _aaz_info = { - "version": "2019-07-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2019-07-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - _args_schema.sku = AAZStrArg( - options=["--sku"], - help="The sku name.", - nullable=True, - enum={"Premium_LRS": "Premium_LRS", "Standard_LRS": "Standard_LRS", "Standard_ZRS": "Standard_ZRS"}, - ) - - # define Arg Group "Encryption" - - _args_schema = cls._args_schema - _args_schema.disk_encryption_set_id = AAZStrArg( - options=["--disk-encryption-set-id"], - arg_group="Encryption", - help="ID of disk encryption set that is used to encrypt the disk.", - nullable=True, - ) - _args_schema.encryption_type = AAZStrArg( - options=["--encryption-type"], - arg_group="Encryption", - help={"short-summary": "Encryption type.", "long-summary": "EncryptionAtRestWithPlatformKey: Disk is encrypted with XStore managed key at rest. It is the default encryption type. EncryptionAtRestWithCustomerKey: Disk is encrypted with Customer managed key at rest."}, - nullable=True, - enum={"EncryptionAtRestWithCustomerKey": "EncryptionAtRestWithCustomerKey", "EncryptionAtRestWithPlatformKey": "EncryptionAtRestWithPlatformKey"}, - ) - - # define Arg Group "Properties" - - # define Arg Group "Snapshot" - return cls._args_schema - - _args_source_vault_update = None - - @classmethod - def _build_args_source_vault_update(cls, _schema): - if cls._args_source_vault_update is not None: - _schema.id = cls._args_source_vault_update.id - return - - cls._args_source_vault_update = AAZObjectArg() - - source_vault_update = cls._args_source_vault_update - source_vault_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_source_vault_update.id - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - yield self.SnapshotsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - class SnapshotsCreateOrUpdate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2019-07-01", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_snapshot_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("encryption", AAZObjectType) - - encryption = _builder.get(".properties.encryption") - if encryption is not None: - encryption.set_prop("diskEncryptionSetId", AAZStrType, ".disk_encryption_set_id") - encryption.set_prop("type", AAZStrType, ".encryption_type") - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("name", AAZStrType, ".sku") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_source_vault_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_snapshot_read = None - - @classmethod - def _build_schema_snapshot_read(cls, _schema): - if cls._schema_snapshot_read is not None: - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - return - - cls._schema_snapshot_read = _schema_snapshot_read = AAZObjectType() - - snapshot_read = _schema_snapshot_read - snapshot_read.id = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.location = AAZStrType( - flags={"required": True}, - ) - snapshot_read.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - snapshot_read.name = AAZStrType( - flags={"read_only": True}, - ) - snapshot_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - snapshot_read.sku = AAZObjectType() - snapshot_read.tags = AAZDictType() - snapshot_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_snapshot_read.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.incremental = AAZBoolType() - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = _schema_snapshot_read.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = _schema_snapshot_read.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption = _schema_snapshot_read.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = _schema_snapshot_read.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = _schema_snapshot_read.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = _schema_snapshot_read.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_snapshot_read.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_snapshot_read.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = _schema_snapshot_read.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = _schema_snapshot_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_snapshot_read.id - _schema.location = cls._schema_snapshot_read.location - _schema.managed_by = cls._schema_snapshot_read.managed_by - _schema.name = cls._schema_snapshot_read.name - _schema.properties = cls._schema_snapshot_read.properties - _schema.sku = cls._schema_snapshot_read.sku - _schema.tags = cls._schema_snapshot_read.tags - _schema.type = cls._schema_snapshot_read.type - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_wait.py deleted file mode 100644 index 110e6360f6a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/snapshot/_wait.py +++ /dev/null @@ -1,320 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "snapshot wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/snapshots/{}", "2019-07-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.snapshot_name = AAZStrArg( - options=["-n", "--name", "--snapshot-name"], - help="The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The max name length is 80 characters.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.SnapshotsGet(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=False) - return result - - class SnapshotsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "snapshotName", self.ctx.args.snapshot_name, - required=True, - ), - **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", "2019-07-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.managed_by = AAZStrType( - serialized_name="managedBy", - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.creation_data = AAZObjectType( - serialized_name="creationData", - flags={"required": True}, - ) - properties.disk_size_bytes = AAZIntType( - serialized_name="diskSizeBytes", - flags={"read_only": True}, - ) - properties.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - properties.encryption = AAZObjectType() - properties.encryption_settings_collection = AAZObjectType( - serialized_name="encryptionSettingsCollection", - ) - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.incremental = AAZBoolType() - properties.os_type = AAZStrType( - serialized_name="osType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - - creation_data = cls._schema_on_200.properties.creation_data - creation_data.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - creation_data.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - creation_data.source_resource_id = AAZStrType( - serialized_name="sourceResourceId", - ) - creation_data.source_unique_id = AAZStrType( - serialized_name="sourceUniqueId", - flags={"read_only": True}, - ) - creation_data.source_uri = AAZStrType( - serialized_name="sourceUri", - ) - creation_data.storage_account_id = AAZStrType( - serialized_name="storageAccountId", - ) - creation_data.upload_size_bytes = AAZIntType( - serialized_name="uploadSizeBytes", - ) - - image_reference = cls._schema_on_200.properties.creation_data.image_reference - image_reference.id = AAZStrType() - image_reference.lun = AAZIntType() - - encryption = cls._schema_on_200.properties.encryption - encryption.disk_encryption_set_id = AAZStrType( - serialized_name="diskEncryptionSetId", - ) - encryption.type = AAZStrType() - - encryption_settings_collection = cls._schema_on_200.properties.encryption_settings_collection - encryption_settings_collection.enabled = AAZBoolType( - flags={"required": True}, - ) - encryption_settings_collection.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - encryption_settings_collection.encryption_settings_version = AAZStrType( - serialized_name="encryptionSettingsVersion", - ) - - encryption_settings = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings - encryption_settings.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element - _element.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - _element.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(disk_encryption_key.source_vault) - - key_encryption_key = cls._schema_on_200.properties.encryption_settings_collection.encryption_settings.Element.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - _WaitHelper._build_schema_source_vault_read(key_encryption_key.source_vault) - - sku = cls._schema_on_200.sku - sku.name = AAZStrType() - sku.tier = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_source_vault_read = None - - @classmethod - def _build_schema_source_vault_read(cls, _schema): - if cls._schema_source_vault_read is not None: - _schema.id = cls._schema_source_vault_read.id - return - - cls._schema_source_vault_read = _schema_source_vault_read = AAZObjectType() - - source_vault_read = _schema_source_vault_read - source_vault_read.id = AAZStrType() - - _schema.id = cls._schema_source_vault_read.id - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/__cmd_group.py deleted file mode 100644 index 9e6797e0f27..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm", -) -class __CMDGroup(AAZCommandGroup): - """Manage Linux or Windows virtual machines. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/__init__.py deleted file mode 100644 index 98d645c68be..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._assess_patches import * -from ._convert import * -from ._deallocate import * -from ._generalize import * -from ._list_sizes import * -from ._list_skus import * -from ._list_vm_resize_options import * -from ._perform_maintenance import * -from ._reapply import * -from ._redeploy import * -from ._simulate_eviction import * -from ._start import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_assess_patches.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_assess_patches.py deleted file mode 100644 index 9ff5cc977e0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_assess_patches.py +++ /dev/null @@ -1,293 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm assess-patches", -) -class AssessPatches(AAZCommand): - """Assess patches on a VM. - - :example: Assess patches on a VM. - az vm assess-patches -g MyResourceGroup -n MyVm - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/assesspatches", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesAssessPatches(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 VirtualMachinesAssessPatches(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.assessment_activity_id = AAZStrType( - serialized_name="assessmentActivityId", - flags={"read_only": True}, - ) - _schema_on_200.critical_and_security_patch_count = AAZIntType( - serialized_name="criticalAndSecurityPatchCount", - flags={"read_only": True}, - ) - _schema_on_200.error = AAZObjectType() - _AssessPatchesHelper._build_schema_api_error_read(_schema_on_200.error) - _schema_on_200.other_patch_count = AAZIntType( - serialized_name="otherPatchCount", - flags={"read_only": True}, - ) - _schema_on_200.patches = AAZListType( - flags={"read_only": True}, - ) - _schema_on_200.reboot_pending = AAZBoolType( - serialized_name="rebootPending", - flags={"read_only": True}, - ) - _schema_on_200.start_date_time = AAZStrType( - serialized_name="startDateTime", - flags={"read_only": True}, - ) - _schema_on_200.status = AAZStrType( - flags={"read_only": True}, - ) - - patches = cls._schema_on_200.patches - patches.Element = AAZObjectType() - - _element = cls._schema_on_200.patches.Element - _element.activity_id = AAZStrType( - serialized_name="activityId", - flags={"read_only": True}, - ) - _element.assessment_state = AAZStrType( - serialized_name="assessmentState", - flags={"read_only": True}, - ) - _element.classifications = AAZListType( - flags={"read_only": True}, - ) - _element.kbid = AAZStrType( - flags={"read_only": True}, - ) - _element.last_modified_date_time = AAZStrType( - serialized_name="lastModifiedDateTime", - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.patch_id = AAZStrType( - serialized_name="patchId", - flags={"read_only": True}, - ) - _element.published_date = AAZStrType( - serialized_name="publishedDate", - flags={"read_only": True}, - ) - _element.reboot_behavior = AAZStrType( - serialized_name="rebootBehavior", - flags={"read_only": True}, - ) - _element.version = AAZStrType( - flags={"read_only": True}, - ) - - classifications = cls._schema_on_200.patches.Element.classifications - classifications.Element = AAZStrType() - - return cls._schema_on_200 - - -class _AssessPatchesHelper: - """Helper class for AssessPatches""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType() - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - -__all__ = ["AssessPatches"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_convert.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_convert.py deleted file mode 100644 index a472be60ae4..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_convert.py +++ /dev/null @@ -1,154 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm convert", -) -class Convert(AAZCommand): - """Convert a VM with unmanaged disks to use managed disks. - - :example: Convert a VM with unmanaged disks to use managed disks. - az vm convert -g MyResourceGroup -n MyVm - - :example: Convert all VMs with unmanaged disks in a resource group to use managed disks. - az vm convert --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/converttomanageddisks", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesConvertToManagedDisks(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachinesConvertToManagedDisks(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _ConvertHelper: - """Helper class for Convert""" - - -__all__ = ["Convert"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_deallocate.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_deallocate.py deleted file mode 100644 index ea0687d27d8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_deallocate.py +++ /dev/null @@ -1,163 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm deallocate", -) -class Deallocate(AAZCommand): - """Deallocate a VM so that computing resources are no longer allocated (charges no longer apply). The status will change from 'Stopped' to 'Stopped (Deallocated)'. - - For an end-to-end tutorial, see https://learn.microsoft.com/azure/virtual-machines/linux/capture-image - - :example: Deallocate, generalize, and capture a stopped virtual machine. - az vm deallocate -g MyResourceGroup -n MyVm - az vm generalize -g MyResourceGroup -n MyVm - az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix - - :example: Deallocate, generalize, and capture multiple stopped virtual machines. - az vm deallocate --ids vms_ids - az vm generalize --ids vms_ids - az vm capture --ids vms_ids --vhd-name-prefix MyPrefix - - :example: Deallocate a VM. - az vm deallocate --name MyVm --no-wait --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/deallocate", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesDeallocate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachinesDeallocate(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _DeallocateHelper: - """Helper class for Deallocate""" - - -__all__ = ["Deallocate"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_generalize.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_generalize.py deleted file mode 100644 index 7ea7e2465bf..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_generalize.py +++ /dev/null @@ -1,143 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm generalize", -) -class Generalize(AAZCommand): - """Mark a VM as generalized, allowing it to be imaged for multiple deployments. - - For an end-to-end tutorial, see https://learn.microsoft.com/azure/virtual-machines/linux/capture-image - - :example: Deallocate, generalize, and capture a stopped virtual machine. - az vm deallocate -g MyResourceGroup -n MyVm - az vm generalize -g MyResourceGroup -n MyVm - az vm capture -g MyResourceGroup -n MyVm --vhd-name-prefix MyPrefix - - :example: Deallocate, generalize, and capture multiple stopped virtual machines. - az vm deallocate --ids vms_ids - az vm generalize --ids vms_ids - az vm capture --ids vms_ids --vhd-name-prefix MyPrefix - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/generalize", "2020-06-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachinesGeneralize(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachinesGeneralize(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _GeneralizeHelper: - """Helper class for Generalize""" - - -__all__ = ["Generalize"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_sizes.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_sizes.py deleted file mode 100644 index 00f988e8a38..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_sizes.py +++ /dev/null @@ -1,177 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-sizes", -) -class ListSizes(AAZCommand): - """List available sizes for VMs. - - :example: List the available VM sizes in the West US region. - az vm list-sizes -l westus - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/vmsizes", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineSizesList(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.value, client_flatten=True) - return result - - class VirtualMachineSizesList(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.Compute/locations/{location}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListSizesHelper: - """Helper class for ListSizes""" - - -__all__ = ["ListSizes"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_skus.py deleted file mode 100644 index 61042225cb3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_skus.py +++ /dev/null @@ -1,343 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-skus", -) -class ListSkus(AAZCommand): - """Get details for compute-related resource SKUs. - - This command incorporates subscription level restriction, offering the most accurate information. - """ - - _aaz_info = { - "version": "2019-04-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/skus", "2019-04-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply on the operation. Only **location** filter is supported currently.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.ResourceSkusList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class ResourceSkusList(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.Compute/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "api-version", "2019-04-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.api_versions = AAZListType( - serialized_name="apiVersions", - flags={"read_only": True}, - ) - _element.capabilities = AAZListType( - flags={"read_only": True}, - ) - _element.capacity = AAZObjectType( - flags={"read_only": True}, - ) - _element.costs = AAZListType( - flags={"read_only": True}, - ) - _element.family = AAZStrType( - flags={"read_only": True}, - ) - _element.kind = AAZStrType( - flags={"read_only": True}, - ) - _element.location_info = AAZListType( - serialized_name="locationInfo", - flags={"read_only": True}, - ) - _element.locations = AAZListType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.resource_type = AAZStrType( - serialized_name="resourceType", - flags={"read_only": True}, - ) - _element.restrictions = AAZListType( - flags={"read_only": True}, - ) - _element.size = AAZStrType( - flags={"read_only": True}, - ) - _element.tier = AAZStrType( - flags={"read_only": True}, - ) - - api_versions = cls._schema_on_200.value.Element.api_versions - api_versions.Element = AAZStrType() - - capabilities = cls._schema_on_200.value.Element.capabilities - capabilities.Element = AAZObjectType() - _ListSkusHelper._build_schema_resource_sku_capabilities_read(capabilities.Element) - - capacity = cls._schema_on_200.value.Element.capacity - capacity.default = AAZIntType( - flags={"read_only": True}, - ) - capacity.maximum = AAZIntType( - flags={"read_only": True}, - ) - capacity.minimum = AAZIntType( - flags={"read_only": True}, - ) - capacity.scale_type = AAZStrType( - serialized_name="scaleType", - flags={"read_only": True}, - ) - - costs = cls._schema_on_200.value.Element.costs - costs.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.costs.Element - _element.extended_unit = AAZStrType( - serialized_name="extendedUnit", - flags={"read_only": True}, - ) - _element.meter_id = AAZStrType( - serialized_name="meterID", - flags={"read_only": True}, - ) - _element.quantity = AAZIntType( - flags={"read_only": True}, - ) - - location_info = cls._schema_on_200.value.Element.location_info - location_info.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.location_info.Element - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.zone_details = AAZListType( - serialized_name="zoneDetails", - flags={"read_only": True}, - ) - _element.zones = AAZListType( - flags={"read_only": True}, - ) - - zone_details = cls._schema_on_200.value.Element.location_info.Element.zone_details - zone_details.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element - _element.capabilities = AAZListType( - flags={"read_only": True}, - ) - _element.name = AAZListType( - flags={"read_only": True}, - ) - - capabilities = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element.capabilities - capabilities.Element = AAZObjectType() - _ListSkusHelper._build_schema_resource_sku_capabilities_read(capabilities.Element) - - name = cls._schema_on_200.value.Element.location_info.Element.zone_details.Element.name - name.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.location_info.Element.zones - zones.Element = AAZStrType() - - locations = cls._schema_on_200.value.Element.locations - locations.Element = AAZStrType() - - restrictions = cls._schema_on_200.value.Element.restrictions - restrictions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.restrictions.Element - _element.reason_code = AAZStrType( - serialized_name="reasonCode", - flags={"read_only": True}, - ) - _element.restriction_info = AAZObjectType( - serialized_name="restrictionInfo", - flags={"read_only": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.values = AAZListType( - flags={"read_only": True}, - ) - - restriction_info = cls._schema_on_200.value.Element.restrictions.Element.restriction_info - restriction_info.locations = AAZListType( - flags={"read_only": True}, - ) - restriction_info.zones = AAZListType( - flags={"read_only": True}, - ) - - locations = cls._schema_on_200.value.Element.restrictions.Element.restriction_info.locations - locations.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.restrictions.Element.restriction_info.zones - zones.Element = AAZStrType() - - values = cls._schema_on_200.value.Element.restrictions.Element.values - values.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - _schema_resource_sku_capabilities_read = None - - @classmethod - def _build_schema_resource_sku_capabilities_read(cls, _schema): - if cls._schema_resource_sku_capabilities_read is not None: - _schema.name = cls._schema_resource_sku_capabilities_read.name - _schema.value = cls._schema_resource_sku_capabilities_read.value - return - - cls._schema_resource_sku_capabilities_read = _schema_resource_sku_capabilities_read = AAZObjectType() - - resource_sku_capabilities_read = _schema_resource_sku_capabilities_read - resource_sku_capabilities_read.name = AAZStrType( - flags={"read_only": True}, - ) - resource_sku_capabilities_read.value = AAZStrType( - flags={"read_only": True}, - ) - - _schema.name = cls._schema_resource_sku_capabilities_read.name - _schema.value = cls._schema_resource_sku_capabilities_read.value - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_vm_resize_options.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_vm_resize_options.py deleted file mode 100644 index f036000b19d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_list_vm_resize_options.py +++ /dev/null @@ -1,190 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm list-vm-resize-options", -) -class ListVmResizeOptions(AAZCommand): - """List available resizing options for VMs. - - :example: List all available VM sizes for resizing. - az vm list-vm-resize-options -g MyResourceGroup -n MyVm - - :example: List available sizes for all VMs in a resource group. - az vm list-vm-resize-options --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/vmsizes", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachinesListAvailableSizes(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.value, client_flatten=True) - return result - - class VirtualMachinesListAvailableSizes(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListVmResizeOptionsHelper: - """Helper class for ListVmResizeOptions""" - - -__all__ = ["ListVmResizeOptions"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_perform_maintenance.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_perform_maintenance.py deleted file mode 100644 index 147249b985e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_perform_maintenance.py +++ /dev/null @@ -1,148 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm perform-maintenance", -) -class PerformMaintenance(AAZCommand): - """The operation to perform maintenance on a virtual machine. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/performmaintenance", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesPerformMaintenance(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachinesPerformMaintenance(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _PerformMaintenanceHelper: - """Helper class for PerformMaintenance""" - - -__all__ = ["PerformMaintenance"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_reapply.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_reapply.py deleted file mode 100644 index 90adbf3602b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_reapply.py +++ /dev/null @@ -1,154 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm reapply", -) -class Reapply(AAZCommand): - """Reapply VMs. - - :example: Reapply a VM. - az vm reapply -g MyResourceGroup -n MyVm - - :example: Reapply all VMs in a resource group. - az vm reapply --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/reapply", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesReapply(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachinesReapply(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _ReapplyHelper: - """Helper class for Reapply""" - - -__all__ = ["Reapply"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_redeploy.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_redeploy.py deleted file mode 100644 index 4b5047572a4..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_redeploy.py +++ /dev/null @@ -1,154 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm redeploy", -) -class Redeploy(AAZCommand): - """Redeploy an existing VM. - - :example: Redeploy a VM. - az vm redeploy -g MyResourceGroup -n MyVm - - :example: Redeploy all VMs in a resource group. - az vm redeploy --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/redeploy", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesRedeploy(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachinesRedeploy(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _RedeployHelper: - """Helper class for Redeploy""" - - -__all__ = ["Redeploy"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_simulate_eviction.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_simulate_eviction.py deleted file mode 100644 index 1d4a3ba1c56..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_simulate_eviction.py +++ /dev/null @@ -1,134 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm simulate-eviction", -) -class SimulateEviction(AAZCommand): - """Simulate the eviction of a Spot VM. - - :example: Simulate the eviction of a Spot VM. - az vm simulate-eviction --resource-group MyResourceGroup --name MyVm - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/simulateeviction", "2020-06-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachinesSimulateEviction(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachinesSimulateEviction(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 [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_204(self, session): - pass - - -class _SimulateEvictionHelper: - """Helper class for SimulateEviction""" - - -__all__ = ["SimulateEviction"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_start.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_start.py deleted file mode 100644 index fe7f03261dc..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/_start.py +++ /dev/null @@ -1,157 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm start", -) -class Start(AAZCommand): - """Start a stopped VM. - - :example: Start a stopped VM. - az vm start -g MyResourceGroup -n MyVm - - :example: Start all VMs in a resource group. - az vm start --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv) - - :example: Start a stopped VM. - az vm start --name MyVm --no-wait --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/start", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_name = AAZStrArg( - options=["-n", "--name", "--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - required=True, - id_part="name", - configured_default="vm", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachinesStart(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachinesStart(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _StartHelper: - """Helper class for Start""" - - -__all__ = ["Start"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/__cmd_group.py deleted file mode 100644 index 0311e45bc8c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/__cmd_group.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set", -) -class __CMDGroup(AAZCommandGroup): - """Group resources into availability sets. - - To provide redundancy to an application, it is recommended to group two or more virtual machines in an availability set. This configuration ensures that during either a planned or unplanned maintenance event, at least one virtual machine will be available. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/__init__.py deleted file mode 100644 index 8dd5aa6e8ed..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * -from ._list import * -from ._list_sizes import * -from ._show import * -from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_delete.py deleted file mode 100644 index 2b3b9cf3ce3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_delete.py +++ /dev/null @@ -1,138 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set delete", -) -class Delete(AAZCommand): - """Delete an availability set. - - :example: Delete an availability set. - az vm availability-set delete -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2020-06-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class AvailabilitySetsDelete(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) - if session.http_response.status_code in [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_list.py deleted file mode 100644 index 412d873674c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_list.py +++ /dev/null @@ -1,395 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set list", -) -class List(AAZCommand): - """List all availability sets in a subscription. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/availabilitysets", "2020-06-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets", "2020-06-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply to the operation. Allowed values are 'virtualMachines/$ref'.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - if condition_0: - self.AvailabilitySetsListBySubscription(ctx=self.ctx)() - if condition_1: - self.AvailabilitySetsList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class AvailabilitySetsListBySubscription(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.Compute/availabilitySets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.proximity_placement_group = AAZObjectType( - serialized_name="proximityPlacementGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.proximity_placement_group) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.value.Element.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(virtual_machines.Element) - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class AvailabilitySetsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.proximity_placement_group = AAZObjectType( - serialized_name="proximityPlacementGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.proximity_placement_group) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.value.Element.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(virtual_machines.Element) - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_list_sizes.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_list_sizes.py deleted file mode 100644 index 3a1501ef5eb..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_list_sizes.py +++ /dev/null @@ -1,186 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set list-sizes", -) -class ListSizes(AAZCommand): - """List all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. - - :example: List VM sizes for an availability set. - az vm availability-set list-sizes -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}/vmsizes", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsListAvailableSizes(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.value, client_flatten=True) - return result - - class AvailabilitySetsListAvailableSizes(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.max_data_disk_count = AAZIntType( - serialized_name="maxDataDiskCount", - ) - _element.memory_in_mb = AAZIntType( - serialized_name="memoryInMB", - ) - _element.name = AAZStrType() - _element.number_of_cores = AAZIntType( - serialized_name="numberOfCores", - ) - _element.os_disk_size_in_mb = AAZIntType( - serialized_name="osDiskSizeInMB", - ) - _element.resource_disk_size_in_mb = AAZIntType( - serialized_name="resourceDiskSizeInMB", - ) - - return cls._schema_on_200 - - -class _ListSizesHelper: - """Helper class for ListSizes""" - - -__all__ = ["ListSizes"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_show.py deleted file mode 100644 index 49a66c8f70f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_show.py +++ /dev/null @@ -1,238 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set show", -) -class Show(AAZCommand): - """Get information about an availability set. - - :example: Get information about an availability set. - az vm availability-set show -n MyAvSet -g MyResourceGroup - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(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 AvailabilitySetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.proximity_placement_group = AAZObjectType( - serialized_name="proximityPlacementGroup", - ) - _ShowHelper._build_schema_sub_resource_read(properties.proximity_placement_group) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = cls._schema_on_200.properties.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(virtual_machines.Element) - - sku = cls._schema_on_200.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_update.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_update.py deleted file mode 100644 index 82df2c19923..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/availability_set/_update.py +++ /dev/null @@ -1,476 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm availability-set update", -) -class Update(AAZCommand): - """Update an Azure Availability Set. - - :example: Update an availability set - az vm availability-set update -n MyAvSet -g MyResourceGroup - - :example: Update an availability set tag. - az vm availability-set update -n MyAvSet -g MyResourceGroup --set tags.foo=value - - :example: Remove an availability set tag. - az vm availability-set update -n MyAvSet -g MyResourceGroup --remove tags.foo - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/availabilitysets/{}", "2020-06-01"], - ] - } - - AZ_SUPPORT_GENERIC_UPDATE = True - - 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 "" - - _args_schema = cls._args_schema - _args_schema.availability_set_name = AAZStrArg( - options=["-n", "--name", "--availability-set-name"], - help="The name of the availability set.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.platform_fault_domain_count = AAZIntArg( - options=["--platform-fault-domain-count"], - help="Fault Domain count.", - nullable=True, - ) - _args_schema.proximity_placement_group = AAZObjectArg( - options=["--proximity-placement-group"], - help="Specifies information about the proximity placement group that the availability set should be assigned to.

Minimum api-version: 2018-04-01.", - nullable=True, - ) - cls._build_args_sub_resource_update(_args_schema.proximity_placement_group) - _args_schema.sku = AAZObjectArg( - options=["--sku"], - help="Sku of the availability set, only name is required to be set. See AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'.", - nullable=True, - ) - - sku = cls._args_schema.sku - sku.capacity = AAZIntArg( - options=["capacity"], - help="Specifies the number of virtual machines in the scale set.", - nullable=True, - ) - sku.name = AAZStrArg( - options=["name"], - help="The sku name.", - nullable=True, - ) - sku.tier = AAZStrArg( - options=["tier"], - help="Specifies the tier of virtual machines in a scale set.

Possible Values:

**Standard**

**Basic**", - nullable=True, - ) - - # define Arg Group "Properties" - return cls._args_schema - - _args_sub_resource_update = None - - @classmethod - def _build_args_sub_resource_update(cls, _schema): - if cls._args_sub_resource_update is not None: - _schema.id = cls._args_sub_resource_update.id - return - - cls._args_sub_resource_update = AAZObjectArg( - nullable=True, - ) - - sub_resource_update = cls._args_sub_resource_update - sub_resource_update.id = AAZStrArg( - options=["id"], - help="Resource Id", - nullable=True, - ) - - _schema.id = cls._args_sub_resource_update.id - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.AvailabilitySetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class AvailabilitySetsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_availability_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - class AvailabilitySetsCreateOrUpdate(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "availabilitySetName", self.ctx.args.availability_set_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - 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, - value=self.ctx.vars.instance, - ) - - 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() - _UpdateHelper._build_schema_availability_set_read(cls._schema_on_200) - - return cls._schema_on_200 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) - _builder.set_prop("sku", AAZObjectType, ".sku") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("platformFaultDomainCount", AAZIntType, ".platform_fault_domain_count") - _UpdateHelper._build_schema_sub_resource_update(properties.set_prop("proximityPlacementGroup", AAZObjectType, ".proximity_placement_group")) - - sku = _builder.get(".sku") - if sku is not None: - sku.set_prop("capacity", AAZIntType, ".capacity") - sku.set_prop("name", AAZStrType, ".name") - sku.set_prop("tier", AAZStrType, ".tier") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_sub_resource_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_availability_set_read = None - - @classmethod - def _build_schema_availability_set_read(cls, _schema): - if cls._schema_availability_set_read is not None: - _schema.id = cls._schema_availability_set_read.id - _schema.location = cls._schema_availability_set_read.location - _schema.name = cls._schema_availability_set_read.name - _schema.properties = cls._schema_availability_set_read.properties - _schema.sku = cls._schema_availability_set_read.sku - _schema.tags = cls._schema_availability_set_read.tags - _schema.type = cls._schema_availability_set_read.type - return - - cls._schema_availability_set_read = _schema_availability_set_read = AAZObjectType() - - availability_set_read = _schema_availability_set_read - availability_set_read.id = AAZStrType( - flags={"read_only": True}, - ) - availability_set_read.location = AAZStrType( - flags={"required": True}, - ) - availability_set_read.name = AAZStrType( - flags={"read_only": True}, - ) - availability_set_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - availability_set_read.sku = AAZObjectType() - availability_set_read.tags = AAZDictType() - availability_set_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_availability_set_read.properties - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.platform_update_domain_count = AAZIntType( - serialized_name="platformUpdateDomainCount", - ) - properties.proximity_placement_group = AAZObjectType( - serialized_name="proximityPlacementGroup", - ) - cls._build_schema_sub_resource_read(properties.proximity_placement_group) - properties.statuses = AAZListType( - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - ) - - statuses = _schema_availability_set_read.properties.statuses - statuses.Element = AAZObjectType() - - _element = _schema_availability_set_read.properties.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = _schema_availability_set_read.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - cls._build_schema_sub_resource_read(virtual_machines.Element) - - sku = _schema_availability_set_read.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = _schema_availability_set_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_availability_set_read.id - _schema.location = cls._schema_availability_set_read.location - _schema.name = cls._schema_availability_set_read.name - _schema.properties = cls._schema_availability_set_read.properties - _schema.sku = cls._schema_availability_set_read.sku - _schema.tags = cls._schema_availability_set_read.tags - _schema.type = cls._schema_availability_set_read.type - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/__cmd_group.py deleted file mode 100644 index 5951a534238..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/__cmd_group.py +++ /dev/null @@ -1,25 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension", -) -class __CMDGroup(AAZCommandGroup): - """Manage extensions on VMs. - - Extensions are small applications that provide post-deployment configuration and automation tasks on Azure virtual machines. For example, if a virtual machine requires software installation, anti-virus protection, or Docker configuration, a VM extension can be used to complete these tasks. Extensions can be bundled with a new virtual machine deployment or run against any existing system. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/__init__.py deleted file mode 100644 index af9cedd3228..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/_delete.py deleted file mode 100644 index 7ebe0ec9197..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/_delete.py +++ /dev/null @@ -1,175 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension delete", -) -class Delete(AAZCommand): - """Delete operation to delete the extension. - - :example: Use a VM name and extension to delete an extension from a VM. - az vm extension delete -g MyResourceGroup --vm-name MyVm -n MyExtensionName - - :example: Delete extensions with IDs containing the string "MyExtension" from a VM. - az vm extension delete --ids $(az resource list --query "[?contains(name, 'MyExtension')].id" -o tsv) - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachines/{}/extensions/{}", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_extension_name = AAZStrArg( - options=["-n", "--name", "--vm-extension-name"], - help="The name of the virtual machine extension.", - required=True, - id_part="child_name_1", - ) - _args_schema.vm_name = AAZStrArg( - options=["--vm-name"], - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineExtensionsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineExtensionsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmExtensionName", self.ctx.args.vm_extension_name, - required=True, - ), - **self.serialize_url_param( - "vmName", self.ctx.args.vm_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/__cmd_group.py deleted file mode 100644 index 98e25e5aa1d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image", -) -class __CMDGroup(AAZCommandGroup): - """Find the available VM extensions for a subscription and region. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/__init__.py deleted file mode 100644 index 4b2012758a6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list_names import * -from ._list_versions import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_list_names.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_list_names.py deleted file mode 100644 index c6e6a3ab0aa..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_list_names.py +++ /dev/null @@ -1,211 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image list-names", -) -class ListNames(AAZCommand): - """List the names of available extensions. - - :example: Find Docker extensions by publisher and location. - az vm extension image list-names --publisher Microsoft.Azure.Extensions -l westus --query "[?starts_with(name, 'Docker')]" - - :example: Find CustomScript extensions by publisher and location. - az vm extension image list-names --publisher Microsoft.Azure.Extensions -l westus --query "[?starts_with(name, 'Custom')]" - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesListTypes(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 VirtualMachineExtensionImagesListTypes(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **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", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.Element.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListNamesHelper: - """Helper class for ListNames""" - - -__all__ = ["ListNames"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_list_versions.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_list_versions.py deleted file mode 100644 index d21c05c12c8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_list_versions.py +++ /dev/null @@ -1,239 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image list-versions", -) -class ListVersions(AAZCommand): - """List the versions for available extensions. - - :example: Find the available versions for the Docker extension. - az vm extension image list-versions --publisher Microsoft.Azure.Extensions -l westus -n DockerExtension -o table - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types/{}/versions", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name", "--type"], - help="Name of the extension.", - required=True, - id_part="child_name_3", - ) - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply on the operation. Default value is None.", - ) - _args_schema.orderby = AAZStrArg( - options=["--orderby"], - help="The $orderby odata query option.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="The $top odata query option.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesListVersions(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 VirtualMachineExtensionImagesListVersions(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "type", self.ctx.args.name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "$orderby", self.ctx.args.orderby, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.Element.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListVersionsHelper: - """Helper class for ListVersions""" - - -__all__ = ["ListVersions"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_show.py deleted file mode 100644 index 4273ae26c3a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/extension/image/_show.py +++ /dev/null @@ -1,229 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm extension image show", -) -class Show(AAZCommand): - """Display information for an extension. - - :example: Show the CustomScript extension version 2.0.2. - az vm extension image show -l westus -n CustomScript --publisher Microsoft.Azure.Extensions --version 2.0.2 - - :example: Show the latest version of the Docker extension. - az vm extension image list-versions --publisher Microsoft.Azure.Extensions -l westus -n DockerExtension --query "[].name" -o tsv | sort | tail -n 1 - az vm extension image show -l westus --publisher Microsoft.Azure.Extensions -n DockerExtension --version LatestVersion - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmextension/types/{}/versions/{}", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`.", - required=True, - id_part="name", - ) - _args_schema.publisher_name = AAZStrArg( - options=["-p", "--publisher", "--publisher-name"], - help="Image publisher name.", - required=True, - id_part="child_name_1", - ) - _args_schema.name = AAZStrArg( - options=["-n", "--name", "--type"], - help="Name of the extension.", - required=True, - id_part="child_name_3", - ) - _args_schema.version = AAZStrArg( - options=["--version"], - help="Extension version.", - required=True, - id_part="child_name_4", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineExtensionImagesGet(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 VirtualMachineExtensionImagesGet(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher_name, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "type", self.ctx.args.name, - required=True, - ), - **self.serialize_url_param( - "version", self.ctx.args.version, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"required": True, "read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.compute_role = AAZStrType( - serialized_name="computeRole", - flags={"required": True}, - ) - properties.handler_schema = AAZStrType( - serialized_name="handlerSchema", - flags={"required": True}, - ) - properties.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - properties.supports_multiple_extensions = AAZBoolType( - serialized_name="supportsMultipleExtensions", - ) - properties.vm_scale_set_enabled = AAZBoolType( - serialized_name="vmScaleSetEnabled", - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/__cmd_group.py deleted file mode 100644 index f9f1f49a8df..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host", -) -class __CMDGroup(AAZCommandGroup): - """Manage Dedicated Hosts for Virtual Machines - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/__init__.py deleted file mode 100644 index f68091245a7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * -from ._list import * -from ._show import * -from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_delete.py deleted file mode 100644 index 9a26d427198..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_delete.py +++ /dev/null @@ -1,171 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete a dedicated host. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}/hosts/{}", "2022-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.host_group_name = AAZStrArg( - options=["--host-group", "--host-group-name"], - help="The name of the dedicated host group.", - required=True, - id_part="name", - ) - _args_schema.host_name = AAZStrArg( - options=["-n", "--name", "--host-name"], - help="The name of the dedicated host.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.DedicatedHostsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class DedicatedHostsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "hostGroupName", self.ctx.args.host_group_name, - required=True, - ), - **self.serialize_url_param( - "hostName", self.ctx.args.host_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2022-11-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_list.py deleted file mode 100644 index 943a75c1d7f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_list.py +++ /dev/null @@ -1,282 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host list", -) -class List(AAZCommand): - """List dedicated hosts. - - :example: List dedicated hosts. - az vm host list --host-group MyHostGroup --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}/hosts", "2022-11-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.host_group_name = AAZStrArg( - options=["--host-group", "--host-group-name"], - help="The name of the dedicated host group.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DedicatedHostsListByHostGroup(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class DedicatedHostsListByHostGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "hostGroupName", self.ctx.args.host_group_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType( - flags={"required": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.auto_replace_on_failure = AAZBoolType( - serialized_name="autoReplaceOnFailure", - ) - properties.host_id = AAZStrType( - serialized_name="hostId", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - properties.license_type = AAZStrType( - serialized_name="licenseType", - ) - properties.platform_fault_domain = AAZIntType( - serialized_name="platformFaultDomain", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.provisioning_time = AAZStrType( - serialized_name="provisioningTime", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - flags={"read_only": True}, - ) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.asset_id = AAZStrType( - serialized_name="assetId", - flags={"read_only": True}, - ) - instance_view.available_capacity = AAZObjectType( - serialized_name="availableCapacity", - ) - instance_view.statuses = AAZListType() - - available_capacity = cls._schema_on_200.value.Element.properties.instance_view.available_capacity - available_capacity.allocatable_v_ms = AAZListType( - serialized_name="allocatableVMs", - ) - - allocatable_v_ms = cls._schema_on_200.value.Element.properties.instance_view.available_capacity.allocatable_v_ms - allocatable_v_ms.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.available_capacity.allocatable_v_ms.Element - _element.count = AAZFloatType() - _element.vm_size = AAZStrType( - serialized_name="vmSize", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.value.Element.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machines.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_show.py deleted file mode 100644 index d44e51edcf4..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_show.py +++ /dev/null @@ -1,288 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host show", -) -class Show(AAZCommand): - """Get the details of a dedicated host. - - :example: Get the details of a dedicated host. - az vm host show --host-group MyHostGroup --name MyDedicatedHost --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}/hosts/{}", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.host_group_name = AAZStrArg( - options=["--host-group", "--host-group-name"], - help="The name of the dedicated host group.", - required=True, - id_part="name", - ) - _args_schema.host_name = AAZStrArg( - options=["-n", "--name", "--host-name"], - help="The name of the dedicated host.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated host.", - enum={"instanceView": "instanceView", "userData": "userData"}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DedicatedHostsGet(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 DedicatedHostsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "hostGroupName", self.ctx.args.host_group_name, - required=True, - ), - **self.serialize_url_param( - "hostName", self.ctx.args.host_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType( - flags={"required": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.auto_replace_on_failure = AAZBoolType( - serialized_name="autoReplaceOnFailure", - ) - properties.host_id = AAZStrType( - serialized_name="hostId", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - properties.license_type = AAZStrType( - serialized_name="licenseType", - ) - properties.platform_fault_domain = AAZIntType( - serialized_name="platformFaultDomain", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.provisioning_time = AAZStrType( - serialized_name="provisioningTime", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - flags={"read_only": True}, - ) - - instance_view = cls._schema_on_200.properties.instance_view - instance_view.asset_id = AAZStrType( - serialized_name="assetId", - flags={"read_only": True}, - ) - instance_view.available_capacity = AAZObjectType( - serialized_name="availableCapacity", - ) - instance_view.statuses = AAZListType() - - available_capacity = cls._schema_on_200.properties.instance_view.available_capacity - available_capacity.allocatable_v_ms = AAZListType( - serialized_name="allocatableVMs", - ) - - allocatable_v_ms = cls._schema_on_200.properties.instance_view.available_capacity.allocatable_v_ms - allocatable_v_ms.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.instance_view.available_capacity.allocatable_v_ms.Element - _element.count = AAZFloatType() - _element.vm_size = AAZStrType( - serialized_name="vmSize", - ) - - statuses = cls._schema_on_200.properties.instance_view.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.instance_view.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.virtual_machines.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - - sku = cls._schema_on_200.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_wait.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_wait.py deleted file mode 100644 index 1633e91f3a3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/_wait.py +++ /dev/null @@ -1,284 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}/hosts/{}", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.host_group_name = AAZStrArg( - options=["--host-group", "--host-group-name"], - help="The name of the dedicated host group.", - required=True, - id_part="name", - ) - _args_schema.host_name = AAZStrArg( - options=["-n", "--name", "--host-name"], - help="The name of the dedicated host.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the dedicated host. 'UserData' is not supported for dedicated host.", - enum={"instanceView": "instanceView", "userData": "userData"}, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DedicatedHostsGet(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=False) - return result - - class DedicatedHostsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "hostGroupName", self.ctx.args.host_group_name, - required=True, - ), - **self.serialize_url_param( - "hostName", self.ctx.args.host_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.sku = AAZObjectType( - flags={"required": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.auto_replace_on_failure = AAZBoolType( - serialized_name="autoReplaceOnFailure", - ) - properties.host_id = AAZStrType( - serialized_name="hostId", - flags={"read_only": True}, - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - properties.license_type = AAZStrType( - serialized_name="licenseType", - ) - properties.platform_fault_domain = AAZIntType( - serialized_name="platformFaultDomain", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.provisioning_time = AAZStrType( - serialized_name="provisioningTime", - flags={"read_only": True}, - ) - properties.time_created = AAZStrType( - serialized_name="timeCreated", - flags={"read_only": True}, - ) - properties.virtual_machines = AAZListType( - serialized_name="virtualMachines", - flags={"read_only": True}, - ) - - instance_view = cls._schema_on_200.properties.instance_view - instance_view.asset_id = AAZStrType( - serialized_name="assetId", - flags={"read_only": True}, - ) - instance_view.available_capacity = AAZObjectType( - serialized_name="availableCapacity", - ) - instance_view.statuses = AAZListType() - - available_capacity = cls._schema_on_200.properties.instance_view.available_capacity - available_capacity.allocatable_v_ms = AAZListType( - serialized_name="allocatableVMs", - ) - - allocatable_v_ms = cls._schema_on_200.properties.instance_view.available_capacity.allocatable_v_ms - allocatable_v_ms.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.instance_view.available_capacity.allocatable_v_ms.Element - _element.count = AAZFloatType() - _element.vm_size = AAZStrType( - serialized_name="vmSize", - ) - - statuses = cls._schema_on_200.properties.instance_view.statuses - statuses.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.instance_view.statuses.Element - _element.code = AAZStrType() - _element.display_status = AAZStrType( - serialized_name="displayStatus", - ) - _element.level = AAZStrType() - _element.message = AAZStrType() - _element.time = AAZStrType() - - virtual_machines = cls._schema_on_200.properties.virtual_machines - virtual_machines.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.virtual_machines.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - - sku = cls._schema_on_200.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - -__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/__cmd_group.py deleted file mode 100644 index 9819e71aacb..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host group", -) -class __CMDGroup(AAZCommandGroup): - """Manage Dedicated Host Groups - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/__init__.py deleted file mode 100644 index 054d52707ea..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * -from ._list import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_delete.py deleted file mode 100644 index 72e0d5ab55b..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_delete.py +++ /dev/null @@ -1,137 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host group delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete a dedicated host group. - """ - - _aaz_info = { - "version": "2019-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}", "2019-03-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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 "" - - _args_schema = cls._args_schema - _args_schema.host_group_name = AAZStrArg( - options=["-n", "--name", "--host-group-name"], - help="Name of the Dedicated Host Group.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DedicatedHostGroupsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class DedicatedHostGroupsDelete(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) - if session.http_response.status_code in [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "hostGroupName", self.ctx.args.host_group_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-03-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_list.py deleted file mode 100644 index c8f35a2f544..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_list.py +++ /dev/null @@ -1,339 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host group list", -) -class List(AAZCommand): - """List dedicated host groups. - - List dedicated host groups by subscription. If resource group is specified, lists dedicated host groups by resource group. - """ - - _aaz_info = { - "version": "2019-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/hostgroups", "2019-03-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups", "2019-03-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.DedicatedHostGroupsListByResourceGroup(ctx=self.ctx)() - if condition_1: - self.DedicatedHostGroupsListBySubscription(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class DedicatedHostGroupsListByResourceGroup(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.hosts = AAZListType( - flags={"read_only": True}, - ) - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - flags={"required": True}, - ) - - hosts = cls._schema_on_200.value.Element.properties.hosts - hosts.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.hosts.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class DedicatedHostGroupsListBySubscription(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.Compute/hostGroups", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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", "2019-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - properties = cls._schema_on_200.value.Element.properties - properties.hosts = AAZListType( - flags={"read_only": True}, - ) - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - flags={"required": True}, - ) - - hosts = cls._schema_on_200.value.Element.properties.hosts - hosts.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.hosts.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_show.py deleted file mode 100644 index e4f0226d157..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/host/group/_show.py +++ /dev/null @@ -1,205 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm host group show", -) -class Show(AAZCommand): - """Get the details of a dedicated host group. - - :example: Get the details of a dedicated host group. - az vm host group show --name MyDedicatedHostGroup --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2019-03-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/hostgroups/{}", "2019-03-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.host_group_name = AAZStrArg( - options=["-n", "--name", "--host-group-name"], - help="Name of the Dedicated Host Group.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.DedicatedHostGroupsGet(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 DedicatedHostGroupsGet(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "hostGroupName", self.ctx.args.host_group_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2019-03-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.zones = AAZListType() - - properties = cls._schema_on_200.properties - properties.hosts = AAZListType( - flags={"read_only": True}, - ) - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - flags={"required": True}, - ) - - hosts = cls._schema_on_200.properties.hosts - hosts.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.hosts.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/__cmd_group.py deleted file mode 100644 index b78c1878632..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image", -) -class __CMDGroup(AAZCommandGroup): - """Information on available virtual machine images. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/__init__.py deleted file mode 100644 index 069febe7e47..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._list_offers import * -from ._list_publishers import * -from ._list_skus import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list.py deleted file mode 100644 index 53101ac3c0a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list.py +++ /dev/null @@ -1,261 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class List(AAZCommand): - """List a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - ) - _args_schema.sku = AAZStrArg( - options=["-s", "--sku"], - help="A valid image SKU.", - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply on the operation.", - ) - _args_schema.orderby = AAZStrArg( - options=["--orderby"], - ) - _args_schema.top = AAZIntArg( - options=["--top"], - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesList(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 VirtualMachineImagesList(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **self.serialize_url_param( - "skus", self.ctx.args.sku, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "$orderby", self.ctx.args.orderby, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.automatic_os_upgrade_properties = AAZObjectType( - serialized_name="automaticOSUpgradeProperties", - ) - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.disallowed = AAZObjectType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - automatic_os_upgrade_properties = cls._schema_on_200.Element.properties.automatic_os_upgrade_properties - automatic_os_upgrade_properties.automatic_os_upgrade_supported = AAZBoolType( - serialized_name="automaticOSUpgradeSupported", - flags={"required": True}, - ) - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - disallowed = cls._schema_on_200.Element.properties.disallowed - disallowed.vm_disk_type = AAZStrType( - serialized_name="vmDiskType", - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_offers.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_offers.py deleted file mode 100644 index 175c3da7dd0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_offers.py +++ /dev/null @@ -1,235 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-offers", -) -class ListOffers(AAZCommand): - """List a list of virtual machine image offers for the specified location and publisher. - - :example: List all offers from Microsoft in the West US region. - az vm image list-offers -l westus -p MicrosoftWindowsServer - - :example: List all offers from OpenLocic in the West US region. - az vm image list-offers -l westus -p OpenLogic - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListOffers(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 VirtualMachineImagesListOffers(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.automatic_os_upgrade_properties = AAZObjectType( - serialized_name="automaticOSUpgradeProperties", - ) - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.disallowed = AAZObjectType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - automatic_os_upgrade_properties = cls._schema_on_200.Element.properties.automatic_os_upgrade_properties - automatic_os_upgrade_properties.automatic_os_upgrade_supported = AAZBoolType( - serialized_name="automaticOSUpgradeSupported", - flags={"required": True}, - ) - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - disallowed = cls._schema_on_200.Element.properties.disallowed - disallowed.vm_disk_type = AAZStrType( - serialized_name="vmDiskType", - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListOffersHelper: - """Helper class for ListOffers""" - - -__all__ = ["ListOffers"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_publishers.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_publishers.py deleted file mode 100644 index 95e966da9e6..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_publishers.py +++ /dev/null @@ -1,225 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-publishers", -) -class ListPublishers(AAZCommand): - """List a list of virtual machine image publishers for the specified Azure location. - - :example: List all publishers in the West US region. - az vm image list-publishers -l westus - - :example: List all publishers with names starting with "Open" in westus. - az vm image list-publishers -l westus --query "[?starts_with(name, 'Open')]" - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListPublishers(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 VirtualMachineImagesListPublishers(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.Compute/locations/{location}/publishers", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.automatic_os_upgrade_properties = AAZObjectType( - serialized_name="automaticOSUpgradeProperties", - ) - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.disallowed = AAZObjectType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - automatic_os_upgrade_properties = cls._schema_on_200.Element.properties.automatic_os_upgrade_properties - automatic_os_upgrade_properties.automatic_os_upgrade_supported = AAZBoolType( - serialized_name="automaticOSUpgradeSupported", - flags={"required": True}, - ) - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - disallowed = cls._schema_on_200.Element.properties.disallowed - disallowed.vm_disk_type = AAZStrType( - serialized_name="vmDiskType", - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListPublishersHelper: - """Helper class for ListPublishers""" - - -__all__ = ["ListPublishers"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_skus.py deleted file mode 100644 index d170d842a70..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_list_skus.py +++ /dev/null @@ -1,242 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vm image list-skus", -) -class ListSkus(AAZCommand): - """List a list of virtual machine image SKUs for the specified location, publisher, and offer. - - :example: List all skus available for CentOS published by OpenLogic in the West US region. - az vm image list-skus -l westus -f CentOS -p OpenLogic - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - id_part="child_name_3", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesListSkus(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 VirtualMachineImagesListSkus(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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 = AAZListType() - - _schema_on_200 = cls._schema_on_200 - _schema_on_200.Element = AAZObjectType() - - _element = cls._schema_on_200.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - - properties = cls._schema_on_200.Element.properties - properties.automatic_os_upgrade_properties = AAZObjectType( - serialized_name="automaticOSUpgradeProperties", - ) - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.disallowed = AAZObjectType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - automatic_os_upgrade_properties = cls._schema_on_200.Element.properties.automatic_os_upgrade_properties - automatic_os_upgrade_properties.automatic_os_upgrade_supported = AAZBoolType( - serialized_name="automaticOSUpgradeSupported", - flags={"required": True}, - ) - - data_disk_images = cls._schema_on_200.Element.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.Element.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - disallowed = cls._schema_on_200.Element.properties.disallowed - disallowed.vm_disk_type = AAZStrType( - serialized_name="vmDiskType", - ) - - os_disk_image = cls._schema_on_200.Element.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.Element.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_show.py deleted file mode 100644 index e2ad512a690..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vm/image/_show.py +++ /dev/null @@ -1,261 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class Show(AAZCommand): - """Get a virtual machine image. - - :example: Get the details for a VM image available in the Azure Marketplace. - az vm image show --location westus --urn publisher:offer:sku:version - - :example: Show information for the latest available CentOS image from OpenLogic. - az vm image show -l westus -f CentOS -p OpenLogic --sku 7.3 --version $(az vm image list -p OpenLogic -s 7.3 --all --query "[?offer=='CentOS'].version" -o tsv | sort -u | tail -n 1) - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/locations/{}/publishers/{}/artifacttypes/vmimage/offers/{}/skus/{}/versions/{}", "2020-06-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - required=True, - id_part="name", - ) - _args_schema.offer = AAZStrArg( - options=["-f", "--offer"], - help="A valid image publisher offer.", - required=True, - id_part="child_name_3", - ) - _args_schema.publisher = AAZStrArg( - options=["-p", "--publisher"], - help="A valid image publisher.", - required=True, - id_part="child_name_1", - ) - _args_schema.sku = AAZStrArg( - options=["-s", "--sku"], - help="A valid image SKU.", - required=True, - id_part="child_name_4", - ) - _args_schema.version = AAZStrArg( - options=["--version"], - help="A valid image SKU version.", - required=True, - id_part="child_name_5", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineImagesGet(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 VirtualMachineImagesGet(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.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "location", self.ctx.args.location, - required=True, - ), - **self.serialize_url_param( - "offer", self.ctx.args.offer, - required=True, - ), - **self.serialize_url_param( - "publisherName", self.ctx.args.publisher, - required=True, - ), - **self.serialize_url_param( - "skus", self.ctx.args.sku, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "version", self.ctx.args.version, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType() - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - - properties = cls._schema_on_200.properties - properties.automatic_os_upgrade_properties = AAZObjectType( - serialized_name="automaticOSUpgradeProperties", - ) - properties.data_disk_images = AAZListType( - serialized_name="dataDiskImages", - ) - properties.disallowed = AAZObjectType() - properties.hyper_v_generation = AAZStrType( - serialized_name="hyperVGeneration", - ) - properties.os_disk_image = AAZObjectType( - serialized_name="osDiskImage", - ) - properties.plan = AAZObjectType() - - automatic_os_upgrade_properties = cls._schema_on_200.properties.automatic_os_upgrade_properties - automatic_os_upgrade_properties.automatic_os_upgrade_supported = AAZBoolType( - serialized_name="automaticOSUpgradeSupported", - flags={"required": True}, - ) - - data_disk_images = cls._schema_on_200.properties.data_disk_images - data_disk_images.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.data_disk_images.Element - _element.lun = AAZIntType( - flags={"read_only": True}, - ) - - disallowed = cls._schema_on_200.properties.disallowed - disallowed.vm_disk_type = AAZStrType( - serialized_name="vmDiskType", - ) - - os_disk_image = cls._schema_on_200.properties.os_disk_image - os_disk_image.operating_system = AAZStrType( - serialized_name="operatingSystem", - flags={"required": True}, - ) - - plan = cls._schema_on_200.properties.plan - plan.name = AAZStrType( - flags={"required": True}, - ) - plan.product = AAZStrType( - flags={"required": True}, - ) - plan.publisher = AAZStrType( - flags={"required": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/__cmd_group.py deleted file mode 100644 index c3779a0d2d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss", -) -class __CMDGroup(AAZCommandGroup): - """Manage groupings of virtual machines in an Azure Virtual Machine Scale Set (VMSS). - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/__init__.py deleted file mode 100644 index 9284320701a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._delete import * -from ._get_os_upgrade_history import * -from ._list import * -from ._list_instance_public_ips import * -from ._list_instances import * -from ._list_skus import * -from ._perform_maintenance import * -from ._simulate_eviction import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_delete.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_delete.py deleted file mode 100644 index b0cf688ef84..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_delete.py +++ /dev/null @@ -1,159 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss delete", -) -class Delete(AAZCommand): - """Delete a VM scale set. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_get_os_upgrade_history.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_get_os_upgrade_history.py deleted file mode 100644 index 728a40bb695..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_get_os_upgrade_history.py +++ /dev/null @@ -1,293 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss get-os-upgrade-history", -) -class GetOsUpgradeHistory(AAZCommand): - """List the OS upgrades on a VM scale set instance. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/osupgradehistory", "2020-06-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetsGetOSUpgradeHistory(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetsGetOSUpgradeHistory(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.error = AAZObjectType() - _GetOsUpgradeHistoryHelper._build_schema_api_error_read(properties.error) - properties.progress = AAZObjectType() - properties.rollback_info = AAZObjectType( - serialized_name="rollbackInfo", - ) - properties.running_status = AAZObjectType( - serialized_name="runningStatus", - ) - properties.started_by = AAZStrType( - serialized_name="startedBy", - flags={"read_only": True}, - ) - properties.target_image_reference = AAZObjectType( - serialized_name="targetImageReference", - ) - - progress = cls._schema_on_200.value.Element.properties.progress - progress.failed_instance_count = AAZIntType( - serialized_name="failedInstanceCount", - flags={"read_only": True}, - ) - progress.in_progress_instance_count = AAZIntType( - serialized_name="inProgressInstanceCount", - flags={"read_only": True}, - ) - progress.pending_instance_count = AAZIntType( - serialized_name="pendingInstanceCount", - flags={"read_only": True}, - ) - progress.successful_instance_count = AAZIntType( - serialized_name="successfulInstanceCount", - flags={"read_only": True}, - ) - - rollback_info = cls._schema_on_200.value.Element.properties.rollback_info - rollback_info.failed_rolledback_instance_count = AAZIntType( - serialized_name="failedRolledbackInstanceCount", - flags={"read_only": True}, - ) - rollback_info.rollback_error = AAZObjectType( - serialized_name="rollbackError", - ) - _GetOsUpgradeHistoryHelper._build_schema_api_error_read(rollback_info.rollback_error) - rollback_info.successfully_rolledback_instance_count = AAZIntType( - serialized_name="successfullyRolledbackInstanceCount", - flags={"read_only": True}, - ) - - running_status = cls._schema_on_200.value.Element.properties.running_status - running_status.code = AAZStrType( - flags={"read_only": True}, - ) - running_status.end_time = AAZStrType( - serialized_name="endTime", - flags={"read_only": True}, - ) - running_status.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - - target_image_reference = cls._schema_on_200.value.Element.properties.target_image_reference - target_image_reference.exact_version = AAZStrType( - serialized_name="exactVersion", - flags={"read_only": True}, - ) - target_image_reference.id = AAZStrType() - target_image_reference.offer = AAZStrType() - target_image_reference.publisher = AAZStrType() - target_image_reference.sku = AAZStrType() - target_image_reference.version = AAZStrType() - - return cls._schema_on_200 - - -class _GetOsUpgradeHistoryHelper: - """Helper class for GetOsUpgradeHistory""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType() - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - -__all__ = ["GetOsUpgradeHistory"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list.py deleted file mode 100644 index 62fa3f10ffe..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list.py +++ /dev/null @@ -1,1563 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list", -) -class List(AAZCommand): - """List all VM scale sets under a resource group. - - :example: List VMSS - az vmss list --resource-group MyResourceGroup - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.compute/virtualmachinescalesets", "2020-06-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets", "2020-06-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) - condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True - if condition_0: - self.VirtualMachineScaleSetsList(ctx=self.ctx)() - if condition_1: - self.VirtualMachineScaleSetsListAll(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.identity = AAZObjectType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - identity = cls._schema_on_200.value.Element.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.additional_capabilities = AAZObjectType( - serialized_name="additionalCapabilities", - ) - properties.automatic_repairs_policy = AAZObjectType( - serialized_name="automaticRepairsPolicy", - ) - properties.do_not_run_extensions_on_overprovisioned_v_ms = AAZBoolType( - serialized_name="doNotRunExtensionsOnOverprovisionedVMs", - ) - properties.host_group = AAZObjectType( - serialized_name="hostGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.host_group) - properties.overprovision = AAZBoolType() - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.proximity_placement_group = AAZObjectType( - serialized_name="proximityPlacementGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.proximity_placement_group) - properties.scale_in_policy = AAZObjectType( - serialized_name="scaleInPolicy", - ) - properties.single_placement_group = AAZBoolType( - serialized_name="singlePlacementGroup", - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - properties.upgrade_policy = AAZObjectType( - serialized_name="upgradePolicy", - ) - properties.virtual_machine_profile = AAZObjectType( - serialized_name="virtualMachineProfile", - ) - properties.zone_balance = AAZBoolType( - serialized_name="zoneBalance", - ) - - additional_capabilities = cls._schema_on_200.value.Element.properties.additional_capabilities - additional_capabilities.ultra_ssd_enabled = AAZBoolType( - serialized_name="ultraSSDEnabled", - ) - - automatic_repairs_policy = cls._schema_on_200.value.Element.properties.automatic_repairs_policy - automatic_repairs_policy.enabled = AAZBoolType() - automatic_repairs_policy.grace_period = AAZStrType( - serialized_name="gracePeriod", - ) - - scale_in_policy = cls._schema_on_200.value.Element.properties.scale_in_policy - scale_in_policy.rules = AAZListType() - - rules = cls._schema_on_200.value.Element.properties.scale_in_policy.rules - rules.Element = AAZStrType() - - upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy - upgrade_policy.automatic_os_upgrade_policy = AAZObjectType( - serialized_name="automaticOSUpgradePolicy", - ) - upgrade_policy.mode = AAZStrType() - upgrade_policy.rolling_upgrade_policy = AAZObjectType( - serialized_name="rollingUpgradePolicy", - ) - - automatic_os_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.automatic_os_upgrade_policy - automatic_os_upgrade_policy.disable_automatic_rollback = AAZBoolType( - serialized_name="disableAutomaticRollback", - ) - automatic_os_upgrade_policy.enable_automatic_os_upgrade = AAZBoolType( - serialized_name="enableAutomaticOSUpgrade", - ) - - rolling_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.rolling_upgrade_policy - rolling_upgrade_policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - rolling_upgrade_policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - - virtual_machine_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile - virtual_machine_profile.billing_profile = AAZObjectType( - serialized_name="billingProfile", - ) - virtual_machine_profile.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - virtual_machine_profile.eviction_policy = AAZStrType( - serialized_name="evictionPolicy", - ) - virtual_machine_profile.extension_profile = AAZObjectType( - serialized_name="extensionProfile", - ) - virtual_machine_profile.license_type = AAZStrType( - serialized_name="licenseType", - ) - virtual_machine_profile.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - virtual_machine_profile.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - virtual_machine_profile.priority = AAZStrType() - virtual_machine_profile.scheduled_events_profile = AAZObjectType( - serialized_name="scheduledEventsProfile", - ) - virtual_machine_profile.security_profile = AAZObjectType( - serialized_name="securityProfile", - ) - virtual_machine_profile.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - billing_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.billing_profile - billing_profile.max_price = AAZFloatType( - serialized_name="maxPrice", - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - extension_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile - extension_profile.extensions = AAZListType() - extension_profile.extensions_time_budget = AAZStrType( - serialized_name="extensionsTimeBudget", - ) - - extensions = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions - extensions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.enable_automatic_upgrade = AAZBoolType( - serialized_name="enableAutomaticUpgrade", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.provision_after_extensions = AAZListType( - serialized_name="provisionAfterExtensions", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - provision_after_extensions = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element.properties.provision_after_extensions - provision_after_extensions.Element = AAZStrType() - - network_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile - network_profile.health_probe = AAZObjectType( - serialized_name="healthProbe", - ) - _ListHelper._build_schema_api_entity_reference_read(network_profile.health_probe) - network_profile.network_interface_configurations = AAZListType( - serialized_name="networkInterfaceConfigurations", - ) - - network_interface_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations - network_interface_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_fpga = AAZBoolType( - serialized_name="enableFpga", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"required": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.network_security_group) - properties.primary = AAZBoolType() - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_pools = AAZListType( - serialized_name="loadBalancerInboundNatPools", - ) - properties.primary = AAZBoolType() - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.public_ip_address_configuration = AAZObjectType( - serialized_name="publicIPAddressConfiguration", - ) - properties.subnet = AAZObjectType() - _ListHelper._build_schema_api_entity_reference_read(properties.subnet) - - application_gateway_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(application_gateway_backend_address_pools.Element) - - application_security_groups = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(application_security_groups.Element) - - load_balancer_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_inbound_nat_pools - load_balancer_inbound_nat_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_inbound_nat_pools.Element) - - public_ip_address_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration - public_ip_address_configuration.name = AAZStrType( - flags={"required": True}, - ) - public_ip_address_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - _ListHelper._build_schema_sub_resource_read(properties.public_ip_prefix) - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - flags={"required": True}, - ) - - ip_tags = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - os_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.computer_name_prefix = AAZStrType( - serialized_name="computerNamePrefix", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.patch_settings = AAZObjectType( - serialized_name="patchSettings", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - patch_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.patch_settings - patch_settings.patch_mode = AAZStrType( - serialized_name="patchMode", - ) - - win_rm = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - scheduled_events_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.scheduled_events_profile - scheduled_events_profile.terminate_notification_profile = AAZObjectType( - serialized_name="terminateNotificationProfile", - ) - - terminate_notification_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.scheduled_events_profile.terminate_notification_profile - terminate_notification_profile.enable = AAZBoolType() - terminate_notification_profile.not_before_timeout = AAZStrType( - serialized_name="notBeforeTimeout", - ) - - security_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.security_profile - security_profile.encryption_at_host = AAZBoolType( - serialized_name="encryptionAtHost", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - _element.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - _element.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - image_reference = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.image_reference - image_reference.exact_version = AAZStrType( - serialized_name="exactVersion", - flags={"read_only": True}, - ) - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.diff_disk_settings = AAZObjectType( - serialized_name="diffDiskSettings", - ) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.image = AAZObjectType() - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd_containers = AAZListType( - serialized_name="vhdContainers", - ) - os_disk.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - diff_disk_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings - diff_disk_settings.option = AAZStrType() - diff_disk_settings.placement = AAZStrType() - - image = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.image - image.uri = AAZStrType() - - vhd_containers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.vhd_containers - vhd_containers.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - class VirtualMachineScaleSetsListAll(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.Compute/virtualMachineScaleSets", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.identity = AAZObjectType() - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType() - - identity = cls._schema_on_200.value.Element.identity - identity.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - identity.tenant_id = AAZStrType( - serialized_name="tenantId", - flags={"read_only": True}, - ) - identity.type = AAZStrType() - identity.user_assigned_identities = AAZDictType( - serialized_name="userAssignedIdentities", - ) - - user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities - user_assigned_identities.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element - _element.client_id = AAZStrType( - serialized_name="clientId", - flags={"read_only": True}, - ) - _element.principal_id = AAZStrType( - serialized_name="principalId", - flags={"read_only": True}, - ) - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.additional_capabilities = AAZObjectType( - serialized_name="additionalCapabilities", - ) - properties.automatic_repairs_policy = AAZObjectType( - serialized_name="automaticRepairsPolicy", - ) - properties.do_not_run_extensions_on_overprovisioned_v_ms = AAZBoolType( - serialized_name="doNotRunExtensionsOnOverprovisionedVMs", - ) - properties.host_group = AAZObjectType( - serialized_name="hostGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.host_group) - properties.overprovision = AAZBoolType() - properties.platform_fault_domain_count = AAZIntType( - serialized_name="platformFaultDomainCount", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.proximity_placement_group = AAZObjectType( - serialized_name="proximityPlacementGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.proximity_placement_group) - properties.scale_in_policy = AAZObjectType( - serialized_name="scaleInPolicy", - ) - properties.single_placement_group = AAZBoolType( - serialized_name="singlePlacementGroup", - ) - properties.unique_id = AAZStrType( - serialized_name="uniqueId", - flags={"read_only": True}, - ) - properties.upgrade_policy = AAZObjectType( - serialized_name="upgradePolicy", - ) - properties.virtual_machine_profile = AAZObjectType( - serialized_name="virtualMachineProfile", - ) - properties.zone_balance = AAZBoolType( - serialized_name="zoneBalance", - ) - - additional_capabilities = cls._schema_on_200.value.Element.properties.additional_capabilities - additional_capabilities.ultra_ssd_enabled = AAZBoolType( - serialized_name="ultraSSDEnabled", - ) - - automatic_repairs_policy = cls._schema_on_200.value.Element.properties.automatic_repairs_policy - automatic_repairs_policy.enabled = AAZBoolType() - automatic_repairs_policy.grace_period = AAZStrType( - serialized_name="gracePeriod", - ) - - scale_in_policy = cls._schema_on_200.value.Element.properties.scale_in_policy - scale_in_policy.rules = AAZListType() - - rules = cls._schema_on_200.value.Element.properties.scale_in_policy.rules - rules.Element = AAZStrType() - - upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy - upgrade_policy.automatic_os_upgrade_policy = AAZObjectType( - serialized_name="automaticOSUpgradePolicy", - ) - upgrade_policy.mode = AAZStrType() - upgrade_policy.rolling_upgrade_policy = AAZObjectType( - serialized_name="rollingUpgradePolicy", - ) - - automatic_os_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.automatic_os_upgrade_policy - automatic_os_upgrade_policy.disable_automatic_rollback = AAZBoolType( - serialized_name="disableAutomaticRollback", - ) - automatic_os_upgrade_policy.enable_automatic_os_upgrade = AAZBoolType( - serialized_name="enableAutomaticOSUpgrade", - ) - - rolling_upgrade_policy = cls._schema_on_200.value.Element.properties.upgrade_policy.rolling_upgrade_policy - rolling_upgrade_policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - rolling_upgrade_policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - rolling_upgrade_policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - - virtual_machine_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile - virtual_machine_profile.billing_profile = AAZObjectType( - serialized_name="billingProfile", - ) - virtual_machine_profile.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - virtual_machine_profile.eviction_policy = AAZStrType( - serialized_name="evictionPolicy", - ) - virtual_machine_profile.extension_profile = AAZObjectType( - serialized_name="extensionProfile", - ) - virtual_machine_profile.license_type = AAZStrType( - serialized_name="licenseType", - ) - virtual_machine_profile.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - virtual_machine_profile.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - virtual_machine_profile.priority = AAZStrType() - virtual_machine_profile.scheduled_events_profile = AAZObjectType( - serialized_name="scheduledEventsProfile", - ) - virtual_machine_profile.security_profile = AAZObjectType( - serialized_name="securityProfile", - ) - virtual_machine_profile.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - - billing_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.billing_profile - billing_profile.max_price = AAZFloatType( - serialized_name="maxPrice", - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.virtual_machine_profile.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - extension_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile - extension_profile.extensions = AAZListType() - extension_profile.extensions_time_budget = AAZStrType( - serialized_name="extensionsTimeBudget", - ) - - extensions = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions - extensions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.enable_automatic_upgrade = AAZBoolType( - serialized_name="enableAutomaticUpgrade", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.provision_after_extensions = AAZListType( - serialized_name="provisionAfterExtensions", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - provision_after_extensions = cls._schema_on_200.value.Element.properties.virtual_machine_profile.extension_profile.extensions.Element.properties.provision_after_extensions - provision_after_extensions.Element = AAZStrType() - - network_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile - network_profile.health_probe = AAZObjectType( - serialized_name="healthProbe", - ) - _ListHelper._build_schema_api_entity_reference_read(network_profile.health_probe) - network_profile.network_interface_configurations = AAZListType( - serialized_name="networkInterfaceConfigurations", - ) - - network_interface_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations - network_interface_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_fpga = AAZBoolType( - serialized_name="enableFpga", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"required": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - _ListHelper._build_schema_sub_resource_read(properties.network_security_group) - properties.primary = AAZBoolType() - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_pools = AAZListType( - serialized_name="loadBalancerInboundNatPools", - ) - properties.primary = AAZBoolType() - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.public_ip_address_configuration = AAZObjectType( - serialized_name="publicIPAddressConfiguration", - ) - properties.subnet = AAZObjectType() - _ListHelper._build_schema_api_entity_reference_read(properties.subnet) - - application_gateway_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(application_gateway_backend_address_pools.Element) - - application_security_groups = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(application_security_groups.Element) - - load_balancer_backend_address_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_pools = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_inbound_nat_pools - load_balancer_inbound_nat_pools.Element = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(load_balancer_inbound_nat_pools.Element) - - public_ip_address_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration - public_ip_address_configuration.name = AAZStrType( - flags={"required": True}, - ) - public_ip_address_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - _ListHelper._build_schema_sub_resource_read(properties.public_ip_prefix) - - dns_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - flags={"required": True}, - ) - - ip_tags = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.network_profile.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - os_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.computer_name_prefix = AAZStrType( - serialized_name="computerNamePrefix", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.patch_settings = AAZObjectType( - serialized_name="patchSettings", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - patch_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.patch_settings - patch_settings.patch_mode = AAZStrType( - serialized_name="patchMode", - ) - - win_rm = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - scheduled_events_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.scheduled_events_profile - scheduled_events_profile.terminate_notification_profile = AAZObjectType( - serialized_name="terminateNotificationProfile", - ) - - terminate_notification_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.scheduled_events_profile.terminate_notification_profile - terminate_notification_profile.enable = AAZBoolType() - terminate_notification_profile.not_before_timeout = AAZStrType( - serialized_name="notBeforeTimeout", - ) - - security_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.security_profile - security_profile.encryption_at_host = AAZBoolType( - serialized_name="encryptionAtHost", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - ) - _element.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - _element.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - image_reference = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.image_reference - image_reference.exact_version = AAZStrType( - serialized_name="exactVersion", - flags={"read_only": True}, - ) - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.diff_disk_settings = AAZObjectType( - serialized_name="diffDiskSettings", - ) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.image = AAZObjectType() - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListHelper._build_schema_virtual_machine_scale_set_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd_containers = AAZListType( - serialized_name="vhdContainers", - ) - os_disk.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - diff_disk_settings = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings - diff_disk_settings.option = AAZStrType() - diff_disk_settings.placement = AAZStrType() - - image = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.image - image.uri = AAZStrType() - - vhd_containers = cls._schema_on_200.value.Element.properties.virtual_machine_profile.storage_profile.os_disk.vhd_containers - vhd_containers.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_api_entity_reference_read = None - - @classmethod - def _build_schema_api_entity_reference_read(cls, _schema): - if cls._schema_api_entity_reference_read is not None: - _schema.id = cls._schema_api_entity_reference_read.id - return - - cls._schema_api_entity_reference_read = _schema_api_entity_reference_read = AAZObjectType() - - api_entity_reference_read = _schema_api_entity_reference_read - api_entity_reference_read.id = AAZStrType() - - _schema.id = cls._schema_api_entity_reference_read.id - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_virtual_machine_scale_set_managed_disk_parameters_read = None - - @classmethod - def _build_schema_virtual_machine_scale_set_managed_disk_parameters_read(cls, _schema): - if cls._schema_virtual_machine_scale_set_managed_disk_parameters_read is not None: - _schema.disk_encryption_set = cls._schema_virtual_machine_scale_set_managed_disk_parameters_read.disk_encryption_set - _schema.storage_account_type = cls._schema_virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type - return - - cls._schema_virtual_machine_scale_set_managed_disk_parameters_read = _schema_virtual_machine_scale_set_managed_disk_parameters_read = AAZObjectType() - - virtual_machine_scale_set_managed_disk_parameters_read = _schema_virtual_machine_scale_set_managed_disk_parameters_read - virtual_machine_scale_set_managed_disk_parameters_read.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - disk_encryption_set = _schema_virtual_machine_scale_set_managed_disk_parameters_read.disk_encryption_set - disk_encryption_set.id = AAZStrType() - - _schema.disk_encryption_set = cls._schema_virtual_machine_scale_set_managed_disk_parameters_read.disk_encryption_set - _schema.storage_account_type = cls._schema_virtual_machine_scale_set_managed_disk_parameters_read.storage_account_type - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_instance_public_ips.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_instance_public_ips.py deleted file mode 100644 index abba94d5900..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_instance_public_ips.py +++ /dev/null @@ -1,1535 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 * - - -class ListInstancePublicIps(AAZCommand): - """List information about all public IP addresses on a virtual machine scale set level. - """ - - _aaz_info = { - "version": "2017-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/publicipaddresses", "2017-03-30"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vmss_name = AAZStrArg( - options=["--vmss-name"], - help="The name of the virtual machine scale set.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PublicIPAddressesListVirtualMachineScaleSetPublicIPAddresses(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class PublicIPAddressesListVirtualMachineScaleSetPublicIPAddresses(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.vmss_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2017-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListInstancePublicIpsHelper._build_schema_public_ip_address_read(value.Element) - - return cls._schema_on_200 - - -class _ListInstancePublicIpsHelper: - """Helper class for ListInstancePublicIps""" - - _schema_application_security_group_read = None - - @classmethod - def _build_schema_application_security_group_read(cls, _schema): - if cls._schema_application_security_group_read is not None: - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - return - - cls._schema_application_security_group_read = _schema_application_security_group_read = AAZObjectType() - - application_security_group_read = _schema_application_security_group_read - application_security_group_read.etag = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.id = AAZStrType() - application_security_group_read.location = AAZStrType() - application_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - application_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - application_security_group_read.tags = AAZDictType() - application_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_application_security_group_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - tags = _schema_application_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_application_security_group_read.etag - _schema.id = cls._schema_application_security_group_read.id - _schema.location = cls._schema_application_security_group_read.location - _schema.name = cls._schema_application_security_group_read.name - _schema.properties = cls._schema_application_security_group_read.properties - _schema.tags = cls._schema_application_security_group_read.tags - _schema.type = cls._schema_application_security_group_read.type - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - properties.virtual_network_taps = AAZListType( - serialized_name="virtualNetworkTaps", - ) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - application_security_groups = _schema_network_interface_ip_configuration_read.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(application_security_groups.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rule = AAZObjectType( - serialized_name="outboundRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_rule) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.enable_tcp_reset = AAZBoolType( - serialized_name="enableTcpReset", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - virtual_network_taps = _schema_network_interface_ip_configuration_read.properties.virtual_network_taps - virtual_network_taps.Element = AAZObjectType() - cls._build_schema_virtual_network_tap_read(virtual_network_taps.Element) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_tap_configuration_read = None - - @classmethod - def _build_schema_network_interface_tap_configuration_read(cls, _schema): - if cls._schema_network_interface_tap_configuration_read is not None: - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - return - - cls._schema_network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read = AAZObjectType() - - network_interface_tap_configuration_read = _schema_network_interface_tap_configuration_read - network_interface_tap_configuration_read.etag = AAZStrType() - network_interface_tap_configuration_read.id = AAZStrType() - network_interface_tap_configuration_read.name = AAZStrType() - network_interface_tap_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_tap_configuration_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_tap_configuration_read.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.virtual_network_tap = AAZObjectType( - serialized_name="virtualNetworkTap", - ) - cls._build_schema_virtual_network_tap_read(properties.virtual_network_tap) - - _schema.etag = cls._schema_network_interface_tap_configuration_read.etag - _schema.id = cls._schema_network_interface_tap_configuration_read.id - _schema.name = cls._schema_network_interface_tap_configuration_read.name - _schema.properties = cls._schema_network_interface_tap_configuration_read.properties - _schema.type = cls._schema_network_interface_tap_configuration_read.type - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.hosted_workloads = AAZListType( - serialized_name="hostedWorkloads", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.private_endpoint = AAZObjectType( - serialized_name="privateEndpoint", - ) - cls._build_schema_private_endpoint_read(properties.private_endpoint) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.tap_configurations = AAZListType( - serialized_name="tapConfigurations", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - hosted_workloads = _schema_network_interface_read.properties.hosted_workloads - hosted_workloads.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tap_configurations = _schema_network_interface_read.properties.tap_configurations - tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(tap_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_private_endpoint_read = None - - @classmethod - def _build_schema_private_endpoint_read(cls, _schema): - if cls._schema_private_endpoint_read is not None: - _schema.etag = cls._schema_private_endpoint_read.etag - _schema.id = cls._schema_private_endpoint_read.id - _schema.location = cls._schema_private_endpoint_read.location - _schema.name = cls._schema_private_endpoint_read.name - _schema.properties = cls._schema_private_endpoint_read.properties - _schema.tags = cls._schema_private_endpoint_read.tags - _schema.type = cls._schema_private_endpoint_read.type - return - - cls._schema_private_endpoint_read = _schema_private_endpoint_read = AAZObjectType() - - private_endpoint_read = _schema_private_endpoint_read - private_endpoint_read.etag = AAZStrType() - private_endpoint_read.id = AAZStrType() - private_endpoint_read.location = AAZStrType() - private_endpoint_read.name = AAZStrType( - flags={"read_only": True}, - ) - private_endpoint_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - private_endpoint_read.tags = AAZDictType() - private_endpoint_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_private_endpoint_read.properties - properties.manual_private_link_service_connections = AAZListType( - serialized_name="manualPrivateLinkServiceConnections", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - flags={"read_only": True}, - ) - properties.private_link_service_connections = AAZListType( - serialized_name="privateLinkServiceConnections", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - manual_private_link_service_connections = _schema_private_endpoint_read.properties.manual_private_link_service_connections - manual_private_link_service_connections.Element = AAZObjectType() - cls._build_schema_private_link_service_connection_read(manual_private_link_service_connections.Element) - - network_interfaces = _schema_private_endpoint_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - private_link_service_connections = _schema_private_endpoint_read.properties.private_link_service_connections - private_link_service_connections.Element = AAZObjectType() - cls._build_schema_private_link_service_connection_read(private_link_service_connections.Element) - - tags = _schema_private_endpoint_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_private_endpoint_read.etag - _schema.id = cls._schema_private_endpoint_read.id - _schema.location = cls._schema_private_endpoint_read.location - _schema.name = cls._schema_private_endpoint_read.name - _schema.properties = cls._schema_private_endpoint_read.properties - _schema.tags = cls._schema_private_endpoint_read.tags - _schema.type = cls._schema_private_endpoint_read.type - - _schema_private_link_service_connection_read = None - - @classmethod - def _build_schema_private_link_service_connection_read(cls, _schema): - if cls._schema_private_link_service_connection_read is not None: - _schema.etag = cls._schema_private_link_service_connection_read.etag - _schema.id = cls._schema_private_link_service_connection_read.id - _schema.name = cls._schema_private_link_service_connection_read.name - _schema.properties = cls._schema_private_link_service_connection_read.properties - _schema.type = cls._schema_private_link_service_connection_read.type - return - - cls._schema_private_link_service_connection_read = _schema_private_link_service_connection_read = AAZObjectType() - - private_link_service_connection_read = _schema_private_link_service_connection_read - private_link_service_connection_read.etag = AAZStrType( - flags={"read_only": True}, - ) - private_link_service_connection_read.id = AAZStrType() - private_link_service_connection_read.name = AAZStrType() - private_link_service_connection_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - private_link_service_connection_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_private_link_service_connection_read.properties - properties.group_ids = AAZListType( - serialized_name="groupIds", - ) - properties.private_link_service_connection_state = AAZObjectType( - serialized_name="privateLinkServiceConnectionState", - ) - properties.private_link_service_id = AAZStrType( - serialized_name="privateLinkServiceId", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.request_message = AAZStrType( - serialized_name="requestMessage", - ) - - group_ids = _schema_private_link_service_connection_read.properties.group_ids - group_ids.Element = AAZStrType() - - private_link_service_connection_state = _schema_private_link_service_connection_read.properties.private_link_service_connection_state - private_link_service_connection_state.actions_required = AAZStrType( - serialized_name="actionsRequired", - ) - private_link_service_connection_state.description = AAZStrType() - private_link_service_connection_state.status = AAZStrType() - - _schema.etag = cls._schema_private_link_service_connection_read.etag - _schema.id = cls._schema_private_link_service_connection_read.id - _schema.name = cls._schema_private_link_service_connection_read.name - _schema.properties = cls._schema_private_link_service_connection_read.properties - _schema.type = cls._schema_private_link_service_connection_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.sku = AAZObjectType() - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.zones = AAZListType() - - properties = _schema_public_ip_address_read.properties - properties.ddos_settings = AAZObjectType( - serialized_name="ddosSettings", - ) - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - ddos_settings = _schema_public_ip_address_read.properties.ddos_settings - ddos_settings.ddos_custom_policy = AAZObjectType( - serialized_name="ddosCustomPolicy", - ) - cls._build_schema_sub_resource_read(ddos_settings.ddos_custom_policy) - ddos_settings.protection_coverage = AAZStrType( - serialized_name="protectionCoverage", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - ip_tags = _schema_public_ip_address_read.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = _schema_public_ip_address_read.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - sku = _schema_public_ip_address_read.sku - sku.name = AAZStrType() - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - zones = _schema_public_ip_address_read.zones - zones.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.sku = cls._schema_public_ip_address_read.sku - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - _schema.zones = cls._schema_public_ip_address_read.zones - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - ) - properties.destination_address_prefixes = AAZListType( - serialized_name="destinationAddressPrefixes", - ) - properties.destination_application_security_groups = AAZListType( - serialized_name="destinationApplicationSecurityGroups", - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.destination_port_ranges = AAZListType( - serialized_name="destinationPortRanges", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - ) - properties.source_address_prefixes = AAZListType( - serialized_name="sourceAddressPrefixes", - ) - properties.source_application_security_groups = AAZListType( - serialized_name="sourceApplicationSecurityGroups", - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - properties.source_port_ranges = AAZListType( - serialized_name="sourcePortRanges", - ) - - destination_address_prefixes = _schema_security_rule_read.properties.destination_address_prefixes - destination_address_prefixes.Element = AAZStrType() - - destination_application_security_groups = _schema_security_rule_read.properties.destination_application_security_groups - destination_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(destination_application_security_groups.Element) - - destination_port_ranges = _schema_security_rule_read.properties.destination_port_ranges - destination_port_ranges.Element = AAZStrType() - - source_address_prefixes = _schema_security_rule_read.properties.source_address_prefixes - source_address_prefixes.Element = AAZStrType() - - source_application_security_groups = _schema_security_rule_read.properties.source_application_security_groups - source_application_security_groups.Element = AAZObjectType() - cls._build_schema_application_security_group_read(source_application_security_groups.Element) - - source_port_ranges = _schema_security_rule_read.properties.source_port_ranges - source_port_ranges.Element = AAZStrType() - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.delegations = AAZListType() - properties.ip_configuration_profiles = AAZListType( - serialized_name="ipConfigurationProfiles", - flags={"read_only": True}, - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"read_only": True}, - ) - properties.nat_gateway = AAZObjectType( - serialized_name="natGateway", - ) - cls._build_schema_sub_resource_read(properties.nat_gateway) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.private_endpoint_network_policies = AAZStrType( - serialized_name="privateEndpointNetworkPolicies", - ) - properties.private_endpoints = AAZListType( - serialized_name="privateEndpoints", - flags={"read_only": True}, - ) - properties.private_link_service_network_policies = AAZStrType( - serialized_name="privateLinkServiceNetworkPolicies", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.purpose = AAZStrType( - flags={"read_only": True}, - ) - properties.resource_navigation_links = AAZListType( - serialized_name="resourceNavigationLinks", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - properties.service_association_links = AAZListType( - serialized_name="serviceAssociationLinks", - ) - properties.service_endpoint_policies = AAZListType( - serialized_name="serviceEndpointPolicies", - ) - properties.service_endpoints = AAZListType( - serialized_name="serviceEndpoints", - ) - - address_prefixes = _schema_subnet_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - delegations = _schema_subnet_read.properties.delegations - delegations.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.delegations.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.delegations.Element.properties - properties.actions = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service_name = AAZStrType( - serialized_name="serviceName", - ) - - actions = _schema_subnet_read.properties.delegations.Element.properties.actions - actions.Element = AAZStrType() - - ip_configuration_profiles = _schema_subnet_read.properties.ip_configuration_profiles - ip_configuration_profiles.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.ip_configuration_profiles.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.ip_configuration_profiles.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - private_endpoints = _schema_subnet_read.properties.private_endpoints - private_endpoints.Element = AAZObjectType() - cls._build_schema_private_endpoint_read(private_endpoints.Element) - - resource_navigation_links = _schema_subnet_read.properties.resource_navigation_links - resource_navigation_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.resource_navigation_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.resource_navigation_links.Element.properties - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.disable_bgp_route_propagation = AAZBoolType( - serialized_name="disableBgpRoutePropagation", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - service_association_links = _schema_subnet_read.properties.service_association_links - service_association_links.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_association_links.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.type = AAZStrType() - - properties = _schema_subnet_read.properties.service_association_links.Element.properties - properties.allow_delete = AAZBoolType( - serialized_name="allowDelete", - ) - properties.link = AAZStrType() - properties.linked_resource_type = AAZStrType( - serialized_name="linkedResourceType", - ) - properties.locations = AAZListType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - locations = _schema_subnet_read.properties.service_association_links.Element.properties.locations - locations.Element = AAZStrType() - - service_endpoint_policies = _schema_subnet_read.properties.service_endpoint_policies - service_endpoint_policies.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.location = AAZStrType() - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - properties.service_endpoint_policy_definitions = AAZListType( - serialized_name="serviceEndpointPolicyDefinitions", - ) - properties.subnets = AAZListType( - flags={"read_only": True}, - ) - - service_endpoint_policy_definitions = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions - service_endpoint_policy_definitions.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties - properties.description = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.service = AAZStrType() - properties.service_resources = AAZListType( - serialized_name="serviceResources", - ) - - service_resources = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.service_endpoint_policy_definitions.Element.properties.service_resources - service_resources.Element = AAZStrType() - - subnets = _schema_subnet_read.properties.service_endpoint_policies.Element.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.service_endpoint_policies.Element.tags - tags.Element = AAZStrType() - - service_endpoints = _schema_subnet_read.properties.service_endpoints - service_endpoints.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.service_endpoints.Element - _element.locations = AAZListType() - _element.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - _element.service = AAZStrType() - - locations = _schema_subnet_read.properties.service_endpoints.Element.locations - locations.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - _schema_virtual_network_tap_read = None - - @classmethod - def _build_schema_virtual_network_tap_read(cls, _schema): - if cls._schema_virtual_network_tap_read is not None: - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - return - - cls._schema_virtual_network_tap_read = _schema_virtual_network_tap_read = AAZObjectType() - - virtual_network_tap_read = _schema_virtual_network_tap_read - virtual_network_tap_read.etag = AAZStrType() - virtual_network_tap_read.id = AAZStrType() - virtual_network_tap_read.location = AAZStrType() - virtual_network_tap_read.name = AAZStrType( - flags={"read_only": True}, - ) - virtual_network_tap_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - virtual_network_tap_read.tags = AAZDictType() - virtual_network_tap_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_virtual_network_tap_read.properties - properties.destination_load_balancer_front_end_ip_configuration = AAZObjectType( - serialized_name="destinationLoadBalancerFrontEndIPConfiguration", - ) - properties.destination_network_interface_ip_configuration = AAZObjectType( - serialized_name="destinationNetworkInterfaceIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.destination_network_interface_ip_configuration) - properties.destination_port = AAZIntType( - serialized_name="destinationPort", - ) - properties.network_interface_tap_configurations = AAZListType( - serialized_name="networkInterfaceTapConfigurations", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - flags={"read_only": True}, - ) - - destination_load_balancer_front_end_ip_configuration = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration - destination_load_balancer_front_end_ip_configuration.etag = AAZStrType() - destination_load_balancer_front_end_ip_configuration.id = AAZStrType() - destination_load_balancer_front_end_ip_configuration.name = AAZStrType() - destination_load_balancer_front_end_ip_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - destination_load_balancer_front_end_ip_configuration.type = AAZStrType( - flags={"read_only": True}, - ) - destination_load_balancer_front_end_ip_configuration.zones = AAZListType() - - properties = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties - properties.inbound_nat_pools = AAZListType( - serialized_name="inboundNatPools", - flags={"read_only": True}, - ) - properties.inbound_nat_rules = AAZListType( - serialized_name="inboundNatRules", - flags={"read_only": True}, - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - flags={"read_only": True}, - ) - properties.outbound_rules = AAZListType( - serialized_name="outboundRules", - flags={"read_only": True}, - ) - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - cls._build_schema_sub_resource_read(properties.public_ip_prefix) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - inbound_nat_pools = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_pools - inbound_nat_pools.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_pools.Element) - - inbound_nat_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.inbound_nat_rules - inbound_nat_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(inbound_nat_rules.Element) - - load_balancing_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - outbound_rules = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.properties.outbound_rules - outbound_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(outbound_rules.Element) - - zones = _schema_virtual_network_tap_read.properties.destination_load_balancer_front_end_ip_configuration.zones - zones.Element = AAZStrType() - - network_interface_tap_configurations = _schema_virtual_network_tap_read.properties.network_interface_tap_configurations - network_interface_tap_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_tap_configuration_read(network_interface_tap_configurations.Element) - - tags = _schema_virtual_network_tap_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_virtual_network_tap_read.etag - _schema.id = cls._schema_virtual_network_tap_read.id - _schema.location = cls._schema_virtual_network_tap_read.location - _schema.name = cls._schema_virtual_network_tap_read.name - _schema.properties = cls._schema_virtual_network_tap_read.properties - _schema.tags = cls._schema_virtual_network_tap_read.tags - _schema.type = cls._schema_virtual_network_tap_read.type - - -__all__ = ["ListInstancePublicIps"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_instances.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_instances.py deleted file mode 100644 index 3f38788af92..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_instances.py +++ /dev/null @@ -1,1054 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list-instances", -) -class ListInstances(AAZCommand): - """List all virtual machines in a VM scale sets. - - Return a list of virtual machines managed by VMSS. For VMSS in Flexible Orchestration mode, please use "az vm list" to get full details. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines", "2020-06-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--virtual-machine-scale-set-name"], - help="The name of the VM scale set.", - required=True, - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="The expand expression to apply to the operation. Allowed values are 'instanceView'.", - ) - _args_schema.filter = AAZStrArg( - options=["--filter"], - help="The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.", - ) - _args_schema.select = AAZStrArg( - options=["--select"], - help="The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetVMsList(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetVMsList(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "$filter", self.ctx.args.filter, - ), - **self.serialize_query_param( - "$select", self.ctx.args.select, - ), - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.instance_id = AAZStrType( - serialized_name="instanceId", - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.plan = AAZObjectType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.resources = AAZListType( - flags={"read_only": True}, - ) - _element.sku = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - _element.zones = AAZListType( - flags={"read_only": True}, - ) - - plan = cls._schema_on_200.value.Element.plan - plan.name = AAZStrType() - plan.product = AAZStrType() - plan.promotion_code = AAZStrType( - serialized_name="promotionCode", - ) - plan.publisher = AAZStrType() - - properties = cls._schema_on_200.value.Element.properties - properties.additional_capabilities = AAZObjectType( - serialized_name="additionalCapabilities", - ) - properties.availability_set = AAZObjectType( - serialized_name="availabilitySet", - ) - _ListInstancesHelper._build_schema_sub_resource_read(properties.availability_set) - properties.diagnostics_profile = AAZObjectType( - serialized_name="diagnosticsProfile", - ) - properties.hardware_profile = AAZObjectType( - serialized_name="hardwareProfile", - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - properties.latest_model_applied = AAZBoolType( - serialized_name="latestModelApplied", - flags={"read_only": True}, - ) - properties.license_type = AAZStrType( - serialized_name="licenseType", - ) - properties.model_definition_applied = AAZStrType( - serialized_name="modelDefinitionApplied", - flags={"read_only": True}, - ) - properties.network_profile = AAZObjectType( - serialized_name="networkProfile", - ) - properties.network_profile_configuration = AAZObjectType( - serialized_name="networkProfileConfiguration", - ) - properties.os_profile = AAZObjectType( - serialized_name="osProfile", - ) - properties.protection_policy = AAZObjectType( - serialized_name="protectionPolicy", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.security_profile = AAZObjectType( - serialized_name="securityProfile", - ) - properties.storage_profile = AAZObjectType( - serialized_name="storageProfile", - ) - properties.vm_id = AAZStrType( - serialized_name="vmId", - flags={"read_only": True}, - ) - - additional_capabilities = cls._schema_on_200.value.Element.properties.additional_capabilities - additional_capabilities.ultra_ssd_enabled = AAZBoolType( - serialized_name="ultraSSDEnabled", - ) - - diagnostics_profile = cls._schema_on_200.value.Element.properties.diagnostics_profile - diagnostics_profile.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.diagnostics_profile.boot_diagnostics - boot_diagnostics.enabled = AAZBoolType() - boot_diagnostics.storage_uri = AAZStrType( - serialized_name="storageUri", - ) - - hardware_profile = cls._schema_on_200.value.Element.properties.hardware_profile - hardware_profile.vm_size = AAZStrType( - serialized_name="vmSize", - ) - - instance_view = cls._schema_on_200.value.Element.properties.instance_view - instance_view.assigned_host = AAZStrType( - serialized_name="assignedHost", - flags={"read_only": True}, - ) - instance_view.boot_diagnostics = AAZObjectType( - serialized_name="bootDiagnostics", - ) - instance_view.disks = AAZListType() - instance_view.extensions = AAZListType() - instance_view.maintenance_redeploy_status = AAZObjectType( - serialized_name="maintenanceRedeployStatus", - ) - instance_view.placement_group_id = AAZStrType( - serialized_name="placementGroupId", - ) - instance_view.platform_fault_domain = AAZIntType( - serialized_name="platformFaultDomain", - ) - instance_view.platform_update_domain = AAZIntType( - serialized_name="platformUpdateDomain", - ) - instance_view.rdp_thumb_print = AAZStrType( - serialized_name="rdpThumbPrint", - ) - instance_view.statuses = AAZListType() - instance_view.vm_agent = AAZObjectType( - serialized_name="vmAgent", - ) - instance_view.vm_health = AAZObjectType( - serialized_name="vmHealth", - ) - - boot_diagnostics = cls._schema_on_200.value.Element.properties.instance_view.boot_diagnostics - boot_diagnostics.console_screenshot_blob_uri = AAZStrType( - serialized_name="consoleScreenshotBlobUri", - flags={"read_only": True}, - ) - boot_diagnostics.serial_console_log_blob_uri = AAZStrType( - serialized_name="serialConsoleLogBlobUri", - flags={"read_only": True}, - ) - boot_diagnostics.status = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(boot_diagnostics.status) - - disks = cls._schema_on_200.value.Element.properties.instance_view.disks - disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.disks.Element - _element.encryption_settings = AAZListType( - serialized_name="encryptionSettings", - ) - _element.name = AAZStrType() - _element.statuses = AAZListType() - - encryption_settings = cls._schema_on_200.value.Element.properties.instance_view.disks.Element.encryption_settings - encryption_settings.Element = AAZObjectType() - _ListInstancesHelper._build_schema_disk_encryption_settings_read(encryption_settings.Element) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.disks.Element.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - extensions = cls._schema_on_200.value.Element.properties.instance_view.extensions - extensions.Element = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_machine_extension_instance_view_read(extensions.Element) - - maintenance_redeploy_status = cls._schema_on_200.value.Element.properties.instance_view.maintenance_redeploy_status - maintenance_redeploy_status.is_customer_initiated_maintenance_allowed = AAZBoolType( - serialized_name="isCustomerInitiatedMaintenanceAllowed", - ) - maintenance_redeploy_status.last_operation_message = AAZStrType( - serialized_name="lastOperationMessage", - ) - maintenance_redeploy_status.last_operation_result_code = AAZStrType( - serialized_name="lastOperationResultCode", - ) - maintenance_redeploy_status.maintenance_window_end_time = AAZStrType( - serialized_name="maintenanceWindowEndTime", - ) - maintenance_redeploy_status.maintenance_window_start_time = AAZStrType( - serialized_name="maintenanceWindowStartTime", - ) - maintenance_redeploy_status.pre_maintenance_window_end_time = AAZStrType( - serialized_name="preMaintenanceWindowEndTime", - ) - maintenance_redeploy_status.pre_maintenance_window_start_time = AAZStrType( - serialized_name="preMaintenanceWindowStartTime", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - vm_agent = cls._schema_on_200.value.Element.properties.instance_view.vm_agent - vm_agent.extension_handlers = AAZListType( - serialized_name="extensionHandlers", - ) - vm_agent.statuses = AAZListType() - vm_agent.vm_agent_version = AAZStrType( - serialized_name="vmAgentVersion", - ) - - extension_handlers = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.extension_handlers - extension_handlers.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.extension_handlers.Element - _element.status = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(_element.status) - _element.type = AAZStrType() - _element.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - statuses = cls._schema_on_200.value.Element.properties.instance_view.vm_agent.statuses - statuses.Element = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(statuses.Element) - - vm_health = cls._schema_on_200.value.Element.properties.instance_view.vm_health - vm_health.status = AAZObjectType() - _ListInstancesHelper._build_schema_instance_view_status_read(vm_health.status) - - network_profile = cls._schema_on_200.value.Element.properties.network_profile - network_profile.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - - network_interfaces = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces - network_interfaces.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces.Element - _element.id = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.network_profile.network_interfaces.Element.properties - properties.primary = AAZBoolType() - - network_profile_configuration = cls._schema_on_200.value.Element.properties.network_profile_configuration - network_profile_configuration.network_interface_configurations = AAZListType( - serialized_name="networkInterfaceConfigurations", - ) - - network_interface_configurations = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations - network_interface_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_accelerated_networking = AAZBoolType( - serialized_name="enableAcceleratedNetworking", - ) - properties.enable_fpga = AAZBoolType( - serialized_name="enableFpga", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - flags={"required": True}, - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - _ListInstancesHelper._build_schema_sub_resource_read(properties.network_security_group) - properties.primary = AAZBoolType() - - dns_settings = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.dns_settings - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - - dns_servers = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element - _element.id = AAZStrType() - _element.name = AAZStrType( - flags={"required": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.application_security_groups = AAZListType( - serialized_name="applicationSecurityGroups", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_pools = AAZListType( - serialized_name="loadBalancerInboundNatPools", - ) - properties.primary = AAZBoolType() - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.public_ip_address_configuration = AAZObjectType( - serialized_name="publicIPAddressConfiguration", - ) - properties.subnet = AAZObjectType() - - application_gateway_backend_address_pools = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - _ListInstancesHelper._build_schema_sub_resource_read(application_gateway_backend_address_pools.Element) - - application_security_groups = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.application_security_groups - application_security_groups.Element = AAZObjectType() - _ListInstancesHelper._build_schema_sub_resource_read(application_security_groups.Element) - - load_balancer_backend_address_pools = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - _ListInstancesHelper._build_schema_sub_resource_read(load_balancer_backend_address_pools.Element) - - load_balancer_inbound_nat_pools = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.load_balancer_inbound_nat_pools - load_balancer_inbound_nat_pools.Element = AAZObjectType() - _ListInstancesHelper._build_schema_sub_resource_read(load_balancer_inbound_nat_pools.Element) - - public_ip_address_configuration = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration - public_ip_address_configuration.name = AAZStrType( - flags={"required": True}, - ) - public_ip_address_configuration.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_tags = AAZListType( - serialized_name="ipTags", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_prefix = AAZObjectType( - serialized_name="publicIPPrefix", - ) - _ListInstancesHelper._build_schema_sub_resource_read(properties.public_ip_prefix) - - dns_settings = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - flags={"required": True}, - ) - - ip_tags = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.ip_tags - ip_tags.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.public_ip_address_configuration.properties.ip_tags.Element - _element.ip_tag_type = AAZStrType( - serialized_name="ipTagType", - ) - _element.tag = AAZStrType() - - subnet = cls._schema_on_200.value.Element.properties.network_profile_configuration.network_interface_configurations.Element.properties.ip_configurations.Element.properties.subnet - subnet.id = AAZStrType() - - os_profile = cls._schema_on_200.value.Element.properties.os_profile - os_profile.admin_password = AAZStrType( - serialized_name="adminPassword", - ) - os_profile.admin_username = AAZStrType( - serialized_name="adminUsername", - ) - os_profile.allow_extension_operations = AAZBoolType( - serialized_name="allowExtensionOperations", - ) - os_profile.computer_name = AAZStrType( - serialized_name="computerName", - ) - os_profile.custom_data = AAZStrType( - serialized_name="customData", - ) - os_profile.linux_configuration = AAZObjectType( - serialized_name="linuxConfiguration", - ) - os_profile.require_guest_provision_signal = AAZBoolType( - serialized_name="requireGuestProvisionSignal", - ) - os_profile.secrets = AAZListType() - os_profile.windows_configuration = AAZObjectType( - serialized_name="windowsConfiguration", - ) - - linux_configuration = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration - linux_configuration.disable_password_authentication = AAZBoolType( - serialized_name="disablePasswordAuthentication", - ) - linux_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - linux_configuration.ssh = AAZObjectType() - - ssh = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh - ssh.public_keys = AAZListType( - serialized_name="publicKeys", - ) - - public_keys = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh.public_keys - public_keys.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.linux_configuration.ssh.public_keys.Element - _element.key_data = AAZStrType( - serialized_name="keyData", - ) - _element.path = AAZStrType() - - secrets = cls._schema_on_200.value.Element.properties.os_profile.secrets - secrets.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element - _element.source_vault = AAZObjectType( - serialized_name="sourceVault", - ) - _ListInstancesHelper._build_schema_sub_resource_read(_element.source_vault) - _element.vault_certificates = AAZListType( - serialized_name="vaultCertificates", - ) - - vault_certificates = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element.vault_certificates - vault_certificates.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.secrets.Element.vault_certificates.Element - _element.certificate_store = AAZStrType( - serialized_name="certificateStore", - ) - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - - windows_configuration = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration - windows_configuration.additional_unattend_content = AAZListType( - serialized_name="additionalUnattendContent", - ) - windows_configuration.enable_automatic_updates = AAZBoolType( - serialized_name="enableAutomaticUpdates", - ) - windows_configuration.patch_settings = AAZObjectType( - serialized_name="patchSettings", - ) - windows_configuration.provision_vm_agent = AAZBoolType( - serialized_name="provisionVMAgent", - ) - windows_configuration.time_zone = AAZStrType( - serialized_name="timeZone", - ) - windows_configuration.win_rm = AAZObjectType( - serialized_name="winRM", - ) - - additional_unattend_content = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.additional_unattend_content - additional_unattend_content.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.additional_unattend_content.Element - _element.component_name = AAZStrType( - serialized_name="componentName", - ) - _element.content = AAZStrType() - _element.pass_name = AAZStrType( - serialized_name="passName", - ) - _element.setting_name = AAZStrType( - serialized_name="settingName", - ) - - patch_settings = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.patch_settings - patch_settings.patch_mode = AAZStrType( - serialized_name="patchMode", - ) - - win_rm = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm - win_rm.listeners = AAZListType() - - listeners = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm.listeners - listeners.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.os_profile.windows_configuration.win_rm.listeners.Element - _element.certificate_url = AAZStrType( - serialized_name="certificateUrl", - ) - _element.protocol = AAZStrType() - - protection_policy = cls._schema_on_200.value.Element.properties.protection_policy - protection_policy.protect_from_scale_in = AAZBoolType( - serialized_name="protectFromScaleIn", - ) - protection_policy.protect_from_scale_set_actions = AAZBoolType( - serialized_name="protectFromScaleSetActions", - ) - - security_profile = cls._schema_on_200.value.Element.properties.security_profile - security_profile.encryption_at_host = AAZBoolType( - serialized_name="encryptionAtHost", - ) - - storage_profile = cls._schema_on_200.value.Element.properties.storage_profile - storage_profile.data_disks = AAZListType( - serialized_name="dataDisks", - ) - storage_profile.image_reference = AAZObjectType( - serialized_name="imageReference", - ) - storage_profile.os_disk = AAZObjectType( - serialized_name="osDisk", - ) - - data_disks = cls._schema_on_200.value.Element.properties.storage_profile.data_disks - data_disks.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.storage_profile.data_disks.Element - _element.caching = AAZStrType() - _element.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - _element.disk_iops_read_write = AAZIntType( - serialized_name="diskIOPSReadWrite", - flags={"read_only": True}, - ) - _element.disk_m_bps_read_write = AAZIntType( - serialized_name="diskMBpsReadWrite", - flags={"read_only": True}, - ) - _element.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - _element.image = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(_element.image) - _element.lun = AAZIntType( - flags={"required": True}, - ) - _element.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListInstancesHelper._build_schema_managed_disk_parameters_read(_element.managed_disk) - _element.name = AAZStrType() - _element.to_be_detached = AAZBoolType( - serialized_name="toBeDetached", - ) - _element.vhd = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(_element.vhd) - _element.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - image_reference = cls._schema_on_200.value.Element.properties.storage_profile.image_reference - image_reference.exact_version = AAZStrType( - serialized_name="exactVersion", - flags={"read_only": True}, - ) - image_reference.id = AAZStrType() - image_reference.offer = AAZStrType() - image_reference.publisher = AAZStrType() - image_reference.sku = AAZStrType() - image_reference.version = AAZStrType() - - os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk - os_disk.caching = AAZStrType() - os_disk.create_option = AAZStrType( - serialized_name="createOption", - flags={"required": True}, - ) - os_disk.diff_disk_settings = AAZObjectType( - serialized_name="diffDiskSettings", - ) - os_disk.disk_size_gb = AAZIntType( - serialized_name="diskSizeGB", - ) - os_disk.encryption_settings = AAZObjectType( - serialized_name="encryptionSettings", - ) - _ListInstancesHelper._build_schema_disk_encryption_settings_read(os_disk.encryption_settings) - os_disk.image = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(os_disk.image) - os_disk.managed_disk = AAZObjectType( - serialized_name="managedDisk", - ) - _ListInstancesHelper._build_schema_managed_disk_parameters_read(os_disk.managed_disk) - os_disk.name = AAZStrType() - os_disk.os_type = AAZStrType( - serialized_name="osType", - ) - os_disk.vhd = AAZObjectType() - _ListInstancesHelper._build_schema_virtual_hard_disk_read(os_disk.vhd) - os_disk.write_accelerator_enabled = AAZBoolType( - serialized_name="writeAcceleratorEnabled", - ) - - diff_disk_settings = cls._schema_on_200.value.Element.properties.storage_profile.os_disk.diff_disk_settings - diff_disk_settings.option = AAZStrType() - diff_disk_settings.placement = AAZStrType() - - resources = cls._schema_on_200.value.Element.resources - resources.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.resources.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType( - flags={"required": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.resources.Element.properties - properties.auto_upgrade_minor_version = AAZBoolType( - serialized_name="autoUpgradeMinorVersion", - ) - properties.enable_automatic_upgrade = AAZBoolType( - serialized_name="enableAutomaticUpgrade", - ) - properties.force_update_tag = AAZStrType( - serialized_name="forceUpdateTag", - ) - properties.instance_view = AAZObjectType( - serialized_name="instanceView", - ) - _ListInstancesHelper._build_schema_virtual_machine_extension_instance_view_read(properties.instance_view) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.publisher = AAZStrType() - properties.type = AAZStrType() - properties.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - tags = cls._schema_on_200.value.Element.resources.Element.tags - tags.Element = AAZStrType() - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - zones = cls._schema_on_200.value.Element.zones - zones.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListInstancesHelper: - """Helper class for ListInstances""" - - _schema_disk_encryption_settings_read = None - - @classmethod - def _build_schema_disk_encryption_settings_read(cls, _schema): - if cls._schema_disk_encryption_settings_read is not None: - _schema.disk_encryption_key = cls._schema_disk_encryption_settings_read.disk_encryption_key - _schema.enabled = cls._schema_disk_encryption_settings_read.enabled - _schema.key_encryption_key = cls._schema_disk_encryption_settings_read.key_encryption_key - return - - cls._schema_disk_encryption_settings_read = _schema_disk_encryption_settings_read = AAZObjectType() - - disk_encryption_settings_read = _schema_disk_encryption_settings_read - disk_encryption_settings_read.disk_encryption_key = AAZObjectType( - serialized_name="diskEncryptionKey", - ) - disk_encryption_settings_read.enabled = AAZBoolType() - disk_encryption_settings_read.key_encryption_key = AAZObjectType( - serialized_name="keyEncryptionKey", - ) - - disk_encryption_key = _schema_disk_encryption_settings_read.disk_encryption_key - disk_encryption_key.secret_url = AAZStrType( - serialized_name="secretUrl", - flags={"required": True}, - ) - disk_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_sub_resource_read(disk_encryption_key.source_vault) - - key_encryption_key = _schema_disk_encryption_settings_read.key_encryption_key - key_encryption_key.key_url = AAZStrType( - serialized_name="keyUrl", - flags={"required": True}, - ) - key_encryption_key.source_vault = AAZObjectType( - serialized_name="sourceVault", - flags={"required": True}, - ) - cls._build_schema_sub_resource_read(key_encryption_key.source_vault) - - _schema.disk_encryption_key = cls._schema_disk_encryption_settings_read.disk_encryption_key - _schema.enabled = cls._schema_disk_encryption_settings_read.enabled - _schema.key_encryption_key = cls._schema_disk_encryption_settings_read.key_encryption_key - - _schema_instance_view_status_read = None - - @classmethod - def _build_schema_instance_view_status_read(cls, _schema): - if cls._schema_instance_view_status_read is not None: - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - return - - cls._schema_instance_view_status_read = _schema_instance_view_status_read = AAZObjectType() - - instance_view_status_read = _schema_instance_view_status_read - instance_view_status_read.code = AAZStrType() - instance_view_status_read.display_status = AAZStrType( - serialized_name="displayStatus", - ) - instance_view_status_read.level = AAZStrType() - instance_view_status_read.message = AAZStrType() - instance_view_status_read.time = AAZStrType() - - _schema.code = cls._schema_instance_view_status_read.code - _schema.display_status = cls._schema_instance_view_status_read.display_status - _schema.level = cls._schema_instance_view_status_read.level - _schema.message = cls._schema_instance_view_status_read.message - _schema.time = cls._schema_instance_view_status_read.time - - _schema_managed_disk_parameters_read = None - - @classmethod - def _build_schema_managed_disk_parameters_read(cls, _schema): - if cls._schema_managed_disk_parameters_read is not None: - _schema.disk_encryption_set = cls._schema_managed_disk_parameters_read.disk_encryption_set - _schema.id = cls._schema_managed_disk_parameters_read.id - _schema.storage_account_type = cls._schema_managed_disk_parameters_read.storage_account_type - return - - cls._schema_managed_disk_parameters_read = _schema_managed_disk_parameters_read = AAZObjectType() - - managed_disk_parameters_read = _schema_managed_disk_parameters_read - managed_disk_parameters_read.disk_encryption_set = AAZObjectType( - serialized_name="diskEncryptionSet", - ) - managed_disk_parameters_read.id = AAZStrType() - managed_disk_parameters_read.storage_account_type = AAZStrType( - serialized_name="storageAccountType", - ) - - disk_encryption_set = _schema_managed_disk_parameters_read.disk_encryption_set - disk_encryption_set.id = AAZStrType() - - _schema.disk_encryption_set = cls._schema_managed_disk_parameters_read.disk_encryption_set - _schema.id = cls._schema_managed_disk_parameters_read.id - _schema.storage_account_type = cls._schema_managed_disk_parameters_read.storage_account_type - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_virtual_hard_disk_read = None - - @classmethod - def _build_schema_virtual_hard_disk_read(cls, _schema): - if cls._schema_virtual_hard_disk_read is not None: - _schema.uri = cls._schema_virtual_hard_disk_read.uri - return - - cls._schema_virtual_hard_disk_read = _schema_virtual_hard_disk_read = AAZObjectType() - - virtual_hard_disk_read = _schema_virtual_hard_disk_read - virtual_hard_disk_read.uri = AAZStrType() - - _schema.uri = cls._schema_virtual_hard_disk_read.uri - - _schema_virtual_machine_extension_instance_view_read = None - - @classmethod - def _build_schema_virtual_machine_extension_instance_view_read(cls, _schema): - if cls._schema_virtual_machine_extension_instance_view_read is not None: - _schema.name = cls._schema_virtual_machine_extension_instance_view_read.name - _schema.statuses = cls._schema_virtual_machine_extension_instance_view_read.statuses - _schema.substatuses = cls._schema_virtual_machine_extension_instance_view_read.substatuses - _schema.type = cls._schema_virtual_machine_extension_instance_view_read.type - _schema.type_handler_version = cls._schema_virtual_machine_extension_instance_view_read.type_handler_version - return - - cls._schema_virtual_machine_extension_instance_view_read = _schema_virtual_machine_extension_instance_view_read = AAZObjectType() - - virtual_machine_extension_instance_view_read = _schema_virtual_machine_extension_instance_view_read - virtual_machine_extension_instance_view_read.name = AAZStrType() - virtual_machine_extension_instance_view_read.statuses = AAZListType() - virtual_machine_extension_instance_view_read.substatuses = AAZListType() - virtual_machine_extension_instance_view_read.type = AAZStrType() - virtual_machine_extension_instance_view_read.type_handler_version = AAZStrType( - serialized_name="typeHandlerVersion", - ) - - statuses = _schema_virtual_machine_extension_instance_view_read.statuses - statuses.Element = AAZObjectType() - cls._build_schema_instance_view_status_read(statuses.Element) - - substatuses = _schema_virtual_machine_extension_instance_view_read.substatuses - substatuses.Element = AAZObjectType() - cls._build_schema_instance_view_status_read(substatuses.Element) - - _schema.name = cls._schema_virtual_machine_extension_instance_view_read.name - _schema.statuses = cls._schema_virtual_machine_extension_instance_view_read.statuses - _schema.substatuses = cls._schema_virtual_machine_extension_instance_view_read.substatuses - _schema.type = cls._schema_virtual_machine_extension_instance_view_read.type - _schema.type_handler_version = cls._schema_virtual_machine_extension_instance_view_read.type_handler_version - - -__all__ = ["ListInstances"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_skus.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_skus.py deleted file mode 100644 index d8c42077634..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_list_skus.py +++ /dev/null @@ -1,200 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss list-skus", -) -class ListSkus(AAZCommand): - """List SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/skus", "2020-06-01"], - ] - } - - AZ_SUPPORT_PAGINATION = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetsListSkus(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class VirtualMachineScaleSetsListSkus(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "MgmtErrorFormat" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType( - flags={"required": True}, - ) - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.capacity = AAZObjectType() - _element.resource_type = AAZStrType( - serialized_name="resourceType", - flags={"read_only": True}, - ) - _element.sku = AAZObjectType() - - capacity = cls._schema_on_200.value.Element.capacity - capacity.default_capacity = AAZIntType( - serialized_name="defaultCapacity", - flags={"read_only": True}, - ) - capacity.maximum = AAZIntType( - flags={"read_only": True}, - ) - capacity.minimum = AAZIntType( - flags={"read_only": True}, - ) - capacity.scale_type = AAZStrType( - serialized_name="scaleType", - flags={"read_only": True}, - ) - - sku = cls._schema_on_200.value.Element.sku - sku.capacity = AAZIntType() - sku.name = AAZStrType() - sku.tier = AAZStrType() - - return cls._schema_on_200 - - -class _ListSkusHelper: - """Helper class for ListSkus""" - - -__all__ = ["ListSkus"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_perform_maintenance.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_perform_maintenance.py deleted file mode 100644 index cf60481825d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_perform_maintenance.py +++ /dev/null @@ -1,183 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss perform-maintenance", -) -class PerformMaintenance(AAZCommand): - """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not eligible for perform maintenance will be failed. Please refer to best practices for more details: https://learn.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/performmaintenance", "2020-06-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - id_part="name", - ) - - # define Arg Group "VmInstanceIDs" - - _args_schema = cls._args_schema - _args_schema.instance_ids = AAZListArg( - options=["--instance-ids"], - arg_group="VmInstanceIDs", - help="The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set.", - ) - - instance_ids = cls._args_schema.instance_ids - instance_ids.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetsPerformMaintenance(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetsPerformMaintenance(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance", - **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( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Content-Type", "application/json", - ), - } - return parameters - - @property - def content(self): - _content_value, _builder = self.new_content_builder( - self.ctx.args, - typ=AAZObjectType, - typ_kwargs={"flags": {"client_flatten": True}} - ) - _builder.set_prop("instanceIds", AAZListType, ".instance_ids") - - instance_ids = _builder.get(".instanceIds") - if instance_ids is not None: - instance_ids.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200(self, session): - pass - - -class _PerformMaintenanceHelper: - """Helper class for PerformMaintenance""" - - -__all__ = ["PerformMaintenance"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_simulate_eviction.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_simulate_eviction.py deleted file mode 100644 index f0c296fa253..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/_simulate_eviction.py +++ /dev/null @@ -1,143 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss simulate-eviction", -) -class SimulateEviction(AAZCommand): - """Simulate the eviction of a Spot virtual machine in a VM scale set. - - :example: Simulate the eviction of a Spot virtual machine in a VM scale set. - az vmss simulate-eviction --resource-group MyResourceGroup --name MyScaleSet --instance-id 0 - """ - - _aaz_info = { - "version": "2020-06-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines/{}/simulateeviction", "2020-06-01"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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 "" - - _args_schema = cls._args_schema - _args_schema.instance_id = AAZStrArg( - options=["--instance-id"], - help="The instance ID of the virtual machine.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.vm_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name"], - help="The name of the VM scale set.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetVMsSimulateEviction(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetVMsSimulateEviction(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 [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction", - **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( - "instanceId", self.ctx.args.instance_id, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.vm_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2020-06-01", - required=True, - ), - } - return parameters - - def on_204(self, session): - pass - - -class _SimulateEvictionHelper: - """Helper class for SimulateEviction""" - - -__all__ = ["SimulateEviction"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/__cmd_group.py deleted file mode 100644 index 9a043b70dae..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic", -) -class __CMDGroup(AAZCommandGroup): - """Manage network interfaces of a VMSS. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/__init__.py deleted file mode 100644 index f929fbbe945..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._list import * -from ._list_vm_nics import * -from ._show import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_list.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_list.py deleted file mode 100644 index 96947456a9c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_list.py +++ /dev/null @@ -1,800 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic list", -) -class List(AAZCommand): - """Get all network interfaces in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/networkinterfaces", "2016-03-30"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesListVirtualMachineScaleSetNetworkInterfaces(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesListVirtualMachineScaleSetNetworkInterfaces(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_list_vm_nics.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_list_vm_nics.py deleted file mode 100644 index d2611c73142..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_list_vm_nics.py +++ /dev/null @@ -1,809 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic list-vm-nics", -) -class ListVmNics(AAZCommand): - """Get information about all network interfaces in a virtual machine in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines/{}/networkinterfaces", "2016-03-30"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_paging(self._execute_operations, 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name.", - required=True, - ) - _args_schema.virtualmachine_index = AAZStrArg( - options=["--instance-id", "--virtualmachine-index"], - help="The virtual machine index.", - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfaces(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.value, client_flatten=True) - next_link = self.deserialize_output(self.ctx.vars.instance.next_link) - return result, next_link - - class NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfaces(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - **self.serialize_url_param( - "virtualmachineIndex", self.ctx.args.virtualmachine_index, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.next_link = AAZStrType( - serialized_name="nextLink", - ) - _schema_on_200.value = AAZListType() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - _ListVmNicsHelper._build_schema_network_interface_read(value.Element) - - return cls._schema_on_200 - - -class _ListVmNicsHelper: - """Helper class for ListVmNics""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["ListVmNics"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_show.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_show.py deleted file mode 100644 index 62fe3196cd3..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/nic/_show.py +++ /dev/null @@ -1,819 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss nic show", -) -class Show(AAZCommand): - """Get the specified network interface in a virtual machine scale set. - """ - - _aaz_info = { - "version": "2016-03-30", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/virtualmachines/{}/networkinterfaces/{}", "2016-03-30"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.network_interface_name = AAZStrArg( - options=["-n", "--name", "--network-interface-name"], - help="The network interface (NIC).", - required=True, - id_part="child_name_2", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["--vmss-name", "--virtual-machine-scale-set-name"], - help="Scale set name.", - required=True, - id_part="name", - ) - _args_schema.virtualmachine_index = AAZStrArg( - options=["--instance-id", "--virtualmachine-index"], - help="The virtual machine index.", - required=True, - id_part="child_name_1", - ) - _args_schema.expand = AAZStrArg( - options=["--expand"], - help="Expands referenced resources. Default value is None.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkInterfacesGetVirtualMachineScaleSetNetworkInterface(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 NetworkInterfacesGetVirtualMachineScaleSetNetworkInterface(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}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkInterfaceName", self.ctx.args.network_interface_name, - required=True, - ), - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "virtualMachineScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - **self.serialize_url_param( - "virtualmachineIndex", self.ctx.args.virtualmachine_index, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$expand", self.ctx.args.expand, - ), - **self.serialize_query_param( - "api-version", "2016-03-30", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _ShowHelper._build_schema_network_interface_read(cls._schema_on_200) - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_ip_configuration_read = None - - @classmethod - def _build_schema_ip_configuration_read(cls, _schema): - if cls._schema_ip_configuration_read is not None: - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - return - - cls._schema_ip_configuration_read = _schema_ip_configuration_read = AAZObjectType() - - ip_configuration_read = _schema_ip_configuration_read - ip_configuration_read.etag = AAZStrType() - ip_configuration_read.id = AAZStrType() - ip_configuration_read.name = AAZStrType() - ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_ip_configuration_read.properties - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - _schema.etag = cls._schema_ip_configuration_read.etag - _schema.id = cls._schema_ip_configuration_read.id - _schema.name = cls._schema_ip_configuration_read.name - _schema.properties = cls._schema_ip_configuration_read.properties - - _schema_network_interface_ip_configuration_read = None - - @classmethod - def _build_schema_network_interface_ip_configuration_read(cls, _schema): - if cls._schema_network_interface_ip_configuration_read is not None: - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - return - - cls._schema_network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read = AAZObjectType() - - network_interface_ip_configuration_read = _schema_network_interface_ip_configuration_read - network_interface_ip_configuration_read.etag = AAZStrType() - network_interface_ip_configuration_read.id = AAZStrType() - network_interface_ip_configuration_read.name = AAZStrType() - network_interface_ip_configuration_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties - properties.application_gateway_backend_address_pools = AAZListType( - serialized_name="applicationGatewayBackendAddressPools", - ) - properties.load_balancer_backend_address_pools = AAZListType( - serialized_name="loadBalancerBackendAddressPools", - ) - properties.load_balancer_inbound_nat_rules = AAZListType( - serialized_name="loadBalancerInboundNatRules", - ) - properties.primary = AAZBoolType() - properties.private_ip_address = AAZStrType( - serialized_name="privateIPAddress", - ) - properties.private_ip_address_version = AAZStrType( - serialized_name="privateIPAddressVersion", - ) - properties.private_ip_allocation_method = AAZStrType( - serialized_name="privateIPAllocationMethod", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address = AAZObjectType( - serialized_name="publicIPAddress", - ) - cls._build_schema_public_ip_address_read(properties.public_ip_address) - properties.subnet = AAZObjectType() - cls._build_schema_subnet_read(properties.subnet) - - application_gateway_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools - application_gateway_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties - properties.backend_addresses = AAZListType( - serialized_name="backendAddresses", - ) - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_addresses = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses - backend_addresses.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_addresses.Element - _element.fqdn = AAZStrType() - _element.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.application_gateway_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancer_backend_address_pools = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools - load_balancer_backend_address_pools.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties - properties.backend_ip_configurations = AAZListType( - serialized_name="backendIPConfigurations", - ) - properties.load_balancing_rules = AAZListType( - serialized_name="loadBalancingRules", - ) - properties.outbound_nat_rule = AAZObjectType( - serialized_name="outboundNatRule", - ) - cls._build_schema_sub_resource_read(properties.outbound_nat_rule) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - backend_ip_configurations = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.backend_ip_configurations - backend_ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(backend_ip_configurations.Element) - - load_balancing_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_backend_address_pools.Element.properties.load_balancing_rules - load_balancing_rules.Element = AAZObjectType() - cls._build_schema_sub_resource_read(load_balancing_rules.Element) - - load_balancer_inbound_nat_rules = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules - load_balancer_inbound_nat_rules.Element = AAZObjectType() - - _element = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_network_interface_ip_configuration_read.properties.load_balancer_inbound_nat_rules.Element.properties - properties.backend_ip_configuration = AAZObjectType( - serialized_name="backendIPConfiguration", - ) - cls._build_schema_network_interface_ip_configuration_read(properties.backend_ip_configuration) - properties.backend_port = AAZIntType( - serialized_name="backendPort", - ) - properties.enable_floating_ip = AAZBoolType( - serialized_name="enableFloatingIP", - ) - properties.frontend_ip_configuration = AAZObjectType( - serialized_name="frontendIPConfiguration", - ) - cls._build_schema_sub_resource_read(properties.frontend_ip_configuration) - properties.frontend_port = AAZIntType( - serialized_name="frontendPort", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.protocol = AAZStrType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - _schema.etag = cls._schema_network_interface_ip_configuration_read.etag - _schema.id = cls._schema_network_interface_ip_configuration_read.id - _schema.name = cls._schema_network_interface_ip_configuration_read.name - _schema.properties = cls._schema_network_interface_ip_configuration_read.properties - - _schema_network_interface_read = None - - @classmethod - def _build_schema_network_interface_read(cls, _schema): - if cls._schema_network_interface_read is not None: - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - return - - cls._schema_network_interface_read = _schema_network_interface_read = AAZObjectType() - - network_interface_read = _schema_network_interface_read - network_interface_read.etag = AAZStrType() - network_interface_read.id = AAZStrType() - network_interface_read.location = AAZStrType() - network_interface_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_interface_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_interface_read.tags = AAZDictType() - network_interface_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_interface_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.enable_ip_forwarding = AAZBoolType( - serialized_name="enableIPForwarding", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.mac_address = AAZStrType( - serialized_name="macAddress", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.primary = AAZBoolType() - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.virtual_machine = AAZObjectType( - serialized_name="virtualMachine", - ) - cls._build_schema_sub_resource_read(properties.virtual_machine) - - dns_settings = _schema_network_interface_read.properties.dns_settings - dns_settings.applied_dns_servers = AAZListType( - serialized_name="appliedDnsServers", - ) - dns_settings.dns_servers = AAZListType( - serialized_name="dnsServers", - ) - dns_settings.internal_dns_name_label = AAZStrType( - serialized_name="internalDnsNameLabel", - ) - dns_settings.internal_domain_name_suffix = AAZStrType( - serialized_name="internalDomainNameSuffix", - ) - dns_settings.internal_fqdn = AAZStrType( - serialized_name="internalFqdn", - ) - - applied_dns_servers = _schema_network_interface_read.properties.dns_settings.applied_dns_servers - applied_dns_servers.Element = AAZStrType() - - dns_servers = _schema_network_interface_read.properties.dns_settings.dns_servers - dns_servers.Element = AAZStrType() - - ip_configurations = _schema_network_interface_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_network_interface_ip_configuration_read(ip_configurations.Element) - - tags = _schema_network_interface_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_interface_read.etag - _schema.id = cls._schema_network_interface_read.id - _schema.location = cls._schema_network_interface_read.location - _schema.name = cls._schema_network_interface_read.name - _schema.properties = cls._schema_network_interface_read.properties - _schema.tags = cls._schema_network_interface_read.tags - _schema.type = cls._schema_network_interface_read.type - - _schema_network_security_group_read = None - - @classmethod - def _build_schema_network_security_group_read(cls, _schema): - if cls._schema_network_security_group_read is not None: - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - return - - cls._schema_network_security_group_read = _schema_network_security_group_read = AAZObjectType() - - network_security_group_read = _schema_network_security_group_read - network_security_group_read.etag = AAZStrType() - network_security_group_read.id = AAZStrType() - network_security_group_read.location = AAZStrType() - network_security_group_read.name = AAZStrType( - flags={"read_only": True}, - ) - network_security_group_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - network_security_group_read.tags = AAZDictType() - network_security_group_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_network_security_group_read.properties - properties.default_security_rules = AAZListType( - serialized_name="defaultSecurityRules", - ) - properties.network_interfaces = AAZListType( - serialized_name="networkInterfaces", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - properties.security_rules = AAZListType( - serialized_name="securityRules", - ) - properties.subnets = AAZListType() - - default_security_rules = _schema_network_security_group_read.properties.default_security_rules - default_security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(default_security_rules.Element) - - network_interfaces = _schema_network_security_group_read.properties.network_interfaces - network_interfaces.Element = AAZObjectType() - cls._build_schema_network_interface_read(network_interfaces.Element) - - security_rules = _schema_network_security_group_read.properties.security_rules - security_rules.Element = AAZObjectType() - cls._build_schema_security_rule_read(security_rules.Element) - - subnets = _schema_network_security_group_read.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_network_security_group_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_network_security_group_read.etag - _schema.id = cls._schema_network_security_group_read.id - _schema.location = cls._schema_network_security_group_read.location - _schema.name = cls._schema_network_security_group_read.name - _schema.properties = cls._schema_network_security_group_read.properties - _schema.tags = cls._schema_network_security_group_read.tags - _schema.type = cls._schema_network_security_group_read.type - - _schema_public_ip_address_read = None - - @classmethod - def _build_schema_public_ip_address_read(cls, _schema): - if cls._schema_public_ip_address_read is not None: - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - return - - cls._schema_public_ip_address_read = _schema_public_ip_address_read = AAZObjectType() - - public_ip_address_read = _schema_public_ip_address_read - public_ip_address_read.etag = AAZStrType() - public_ip_address_read.id = AAZStrType() - public_ip_address_read.location = AAZStrType() - public_ip_address_read.name = AAZStrType( - flags={"read_only": True}, - ) - public_ip_address_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - public_ip_address_read.tags = AAZDictType() - public_ip_address_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_public_ip_address_read.properties - properties.dns_settings = AAZObjectType( - serialized_name="dnsSettings", - ) - properties.idle_timeout_in_minutes = AAZIntType( - serialized_name="idleTimeoutInMinutes", - ) - properties.ip_address = AAZStrType( - serialized_name="ipAddress", - ) - properties.ip_configuration = AAZObjectType( - serialized_name="ipConfiguration", - ) - cls._build_schema_ip_configuration_read(properties.ip_configuration) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.public_ip_address_version = AAZStrType( - serialized_name="publicIPAddressVersion", - ) - properties.public_ip_allocation_method = AAZStrType( - serialized_name="publicIPAllocationMethod", - ) - properties.resource_guid = AAZStrType( - serialized_name="resourceGuid", - ) - - dns_settings = _schema_public_ip_address_read.properties.dns_settings - dns_settings.domain_name_label = AAZStrType( - serialized_name="domainNameLabel", - ) - dns_settings.fqdn = AAZStrType() - dns_settings.reverse_fqdn = AAZStrType( - serialized_name="reverseFqdn", - ) - - tags = _schema_public_ip_address_read.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_public_ip_address_read.etag - _schema.id = cls._schema_public_ip_address_read.id - _schema.location = cls._schema_public_ip_address_read.location - _schema.name = cls._schema_public_ip_address_read.name - _schema.properties = cls._schema_public_ip_address_read.properties - _schema.tags = cls._schema_public_ip_address_read.tags - _schema.type = cls._schema_public_ip_address_read.type - - _schema_security_rule_read = None - - @classmethod - def _build_schema_security_rule_read(cls, _schema): - if cls._schema_security_rule_read is not None: - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - return - - cls._schema_security_rule_read = _schema_security_rule_read = AAZObjectType() - - security_rule_read = _schema_security_rule_read - security_rule_read.etag = AAZStrType() - security_rule_read.id = AAZStrType() - security_rule_read.name = AAZStrType() - security_rule_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_security_rule_read.properties - properties.access = AAZStrType( - flags={"required": True}, - ) - properties.description = AAZStrType() - properties.destination_address_prefix = AAZStrType( - serialized_name="destinationAddressPrefix", - flags={"required": True}, - ) - properties.destination_port_range = AAZStrType( - serialized_name="destinationPortRange", - ) - properties.direction = AAZStrType( - flags={"required": True}, - ) - properties.priority = AAZIntType() - properties.protocol = AAZStrType( - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.source_address_prefix = AAZStrType( - serialized_name="sourceAddressPrefix", - flags={"required": True}, - ) - properties.source_port_range = AAZStrType( - serialized_name="sourcePortRange", - ) - - _schema.etag = cls._schema_security_rule_read.etag - _schema.id = cls._schema_security_rule_read.id - _schema.name = cls._schema_security_rule_read.name - _schema.properties = cls._schema_security_rule_read.properties - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - _schema_subnet_read = None - - @classmethod - def _build_schema_subnet_read(cls, _schema): - if cls._schema_subnet_read is not None: - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - return - - cls._schema_subnet_read = _schema_subnet_read = AAZObjectType() - - subnet_read = _schema_subnet_read - subnet_read.etag = AAZStrType() - subnet_read.id = AAZStrType() - subnet_read.name = AAZStrType() - subnet_read.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.ip_configurations = AAZListType( - serialized_name="ipConfigurations", - ) - properties.network_security_group = AAZObjectType( - serialized_name="networkSecurityGroup", - ) - cls._build_schema_network_security_group_read(properties.network_security_group) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.route_table = AAZObjectType( - serialized_name="routeTable", - ) - - ip_configurations = _schema_subnet_read.properties.ip_configurations - ip_configurations.Element = AAZObjectType() - cls._build_schema_ip_configuration_read(ip_configurations.Element) - - route_table = _schema_subnet_read.properties.route_table - route_table.etag = AAZStrType() - route_table.id = AAZStrType() - route_table.location = AAZStrType() - route_table.name = AAZStrType( - flags={"read_only": True}, - ) - route_table.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - route_table.tags = AAZDictType() - route_table.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - properties.routes = AAZListType() - properties.subnets = AAZListType() - - routes = _schema_subnet_read.properties.route_table.properties.routes - routes.Element = AAZObjectType() - - _element = _schema_subnet_read.properties.route_table.properties.routes.Element - _element.etag = AAZStrType() - _element.id = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - - properties = _schema_subnet_read.properties.route_table.properties.routes.Element.properties - properties.address_prefix = AAZStrType( - serialized_name="addressPrefix", - ) - properties.next_hop_ip_address = AAZStrType( - serialized_name="nextHopIpAddress", - ) - properties.next_hop_type = AAZStrType( - serialized_name="nextHopType", - flags={"required": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - ) - - subnets = _schema_subnet_read.properties.route_table.properties.subnets - subnets.Element = AAZObjectType() - cls._build_schema_subnet_read(subnets.Element) - - tags = _schema_subnet_read.properties.route_table.tags - tags.Element = AAZStrType() - - _schema.etag = cls._schema_subnet_read.etag - _schema.id = cls._schema_subnet_read.id - _schema.name = cls._schema_subnet_read.name - _schema.properties = cls._schema_subnet_read.properties - - -__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/__cmd_group.py deleted file mode 100644 index 8cfa2e80689..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/__cmd_group.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade", -) -class __CMDGroup(AAZCommandGroup): - """Manage rolling upgrades. - """ - pass - - -__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/__init__.py deleted file mode 100644 index c1d51771410..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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 ._cancel import * -from ._get_latest import * -from ._start import * diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_cancel.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_cancel.py deleted file mode 100644 index 73ecd2f9844..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_cancel.py +++ /dev/null @@ -1,148 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade cancel", -) -class Cancel(AAZCommand): - """Cancel the current virtual machine scale set rolling upgrade. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/rollingupgrades/cancel", "2022-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetRollingUpgradesCancel(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetRollingUpgradesCancel(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _CancelHelper: - """Helper class for Cancel""" - - -__all__ = ["Cancel"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_get_latest.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_get_latest.py deleted file mode 100644 index 1cc31960367..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_get_latest.py +++ /dev/null @@ -1,290 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade get-latest", -) -class GetLatest(AAZCommand): - """Get the status of the latest virtual machine scale set rolling upgrade. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/rollingupgrades/latest", "2022-11-01"], - ] - } - - 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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.VirtualMachineScaleSetRollingUpgradesGetLatest(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 VirtualMachineScaleSetRollingUpgradesGetLatest(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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType( - flags={"required": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType( - flags={"client_flatten": True}, - ) - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.error = AAZObjectType() - _GetLatestHelper._build_schema_api_error_read(properties.error) - properties.policy = AAZObjectType() - properties.progress = AAZObjectType() - properties.running_status = AAZObjectType( - serialized_name="runningStatus", - ) - - policy = cls._schema_on_200.properties.policy - policy.enable_cross_zone_upgrade = AAZBoolType( - serialized_name="enableCrossZoneUpgrade", - ) - policy.max_batch_instance_percent = AAZIntType( - serialized_name="maxBatchInstancePercent", - ) - policy.max_surge = AAZBoolType( - serialized_name="maxSurge", - ) - policy.max_unhealthy_instance_percent = AAZIntType( - serialized_name="maxUnhealthyInstancePercent", - ) - policy.max_unhealthy_upgraded_instance_percent = AAZIntType( - serialized_name="maxUnhealthyUpgradedInstancePercent", - ) - policy.pause_time_between_batches = AAZStrType( - serialized_name="pauseTimeBetweenBatches", - ) - policy.prioritize_unhealthy_instances = AAZBoolType( - serialized_name="prioritizeUnhealthyInstances", - ) - policy.rollback_failed_instances_on_policy_breach = AAZBoolType( - serialized_name="rollbackFailedInstancesOnPolicyBreach", - ) - - progress = cls._schema_on_200.properties.progress - progress.failed_instance_count = AAZIntType( - serialized_name="failedInstanceCount", - flags={"read_only": True}, - ) - progress.in_progress_instance_count = AAZIntType( - serialized_name="inProgressInstanceCount", - flags={"read_only": True}, - ) - progress.pending_instance_count = AAZIntType( - serialized_name="pendingInstanceCount", - flags={"read_only": True}, - ) - progress.successful_instance_count = AAZIntType( - serialized_name="successfulInstanceCount", - flags={"read_only": True}, - ) - - running_status = cls._schema_on_200.properties.running_status - running_status.code = AAZStrType( - flags={"read_only": True}, - ) - running_status.last_action = AAZStrType( - serialized_name="lastAction", - flags={"read_only": True}, - ) - running_status.last_action_time = AAZStrType( - serialized_name="lastActionTime", - flags={"read_only": True}, - ) - running_status.start_time = AAZStrType( - serialized_name="startTime", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _GetLatestHelper: - """Helper class for GetLatest""" - - _schema_api_error_read = None - - @classmethod - def _build_schema_api_error_read(cls, _schema): - if cls._schema_api_error_read is not None: - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - return - - cls._schema_api_error_read = _schema_api_error_read = AAZObjectType() - - api_error_read = _schema_api_error_read - api_error_read.code = AAZStrType() - api_error_read.details = AAZListType() - api_error_read.innererror = AAZObjectType() - api_error_read.message = AAZStrType() - api_error_read.target = AAZStrType() - - details = _schema_api_error_read.details - details.Element = AAZObjectType() - - _element = _schema_api_error_read.details.Element - _element.code = AAZStrType() - _element.message = AAZStrType() - _element.target = AAZStrType() - - innererror = _schema_api_error_read.innererror - innererror.errordetail = AAZStrType() - innererror.exceptiontype = AAZStrType() - - _schema.code = cls._schema_api_error_read.code - _schema.details = cls._schema_api_error_read.details - _schema.innererror = cls._schema_api_error_read.innererror - _schema.message = cls._schema_api_error_read.message - _schema.target = cls._schema_api_error_read.target - - -__all__ = ["GetLatest"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_start.py b/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_start.py deleted file mode 100644 index 816e0ad19d7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/aaz/profile_2020_09_01_hybrid/vmss/rolling_upgrade/_start.py +++ /dev/null @@ -1,148 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "vmss rolling-upgrade start", -) -class Start(AAZCommand): - """Start a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version. Instances which are already running the latest available OS version are not affected. - """ - - _aaz_info = { - "version": "2022-11-01", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.compute/virtualmachinescalesets/{}/osrollingupgrade", "2022-11-01"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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 "" - - _args_schema = cls._args_schema - _args_schema.resource_group = AAZResourceGroupNameArg( - help="Name of resource group. You can configure the default group using `az configure --defaults group=`.", - required=True, - ) - _args_schema.virtual_machine_scale_set_name = AAZStrArg( - options=["-n", "--name", "--vm-scale-set-name", "--virtual-machine-scale-set-name"], - help="Scale set name. You can configure the default using `az configure --defaults vmss=`.", - required=True, - id_part="name", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.VirtualMachineScaleSetRollingUpgradesStartOSUpgrade(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class VirtualMachineScaleSetRollingUpgradesStartOSUpgrade(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade", - **self.url_parameters - ) - - @property - def method(self): - return "POST" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "resourceGroupName", self.ctx.args.resource_group, - required=True, - ), - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - **self.serialize_url_param( - "vmScaleSetName", self.ctx.args.virtual_machine_scale_set_name, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2022-11-01", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - -class _StartHelper: - """Helper class for Start""" - - -__all__ = ["Start"] diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/__init__.py deleted file mode 100644 index 34913fb394d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_actions.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_actions.py deleted file mode 100644 index 515fc959e78..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_actions.py +++ /dev/null @@ -1,281 +0,0 @@ -# -------------------------------------------------------------------------- -# 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. -# -# Generation mode: Incremental -# -------------------------------------------------------------------------- - -# pylint: disable=too-many-statements -import json - -from knack.log import get_logger -from knack.util import CLIError -from azure.cli.core.commands.arm import resource_exists -from azure.cli.core.commands.parameters import get_one_of_subscription_locations -from ._client_factory import _compute_client_factory -from ._vm_utils import import_aaz_by_profile - -try: - from ..manual.action import * # noqa: F403, pylint: disable=unused-wildcard-import,wildcard-import -except ImportError: - pass - -logger = get_logger(__name__) - - -def _resource_not_exists(cli_ctx, resource_type): - def _handle_resource_not_exists(namespace): - ns, t = resource_type.split('/') - # pylint: disable=protected-access - if resource_exists(cli_ctx, namespace._subscription_id, namespace.resource_group_name, namespace.name, ns, t): - raise CLIError('Resource {} of type {} in group {} already exists.'.format( - namespace.name, - resource_type, - namespace.resource_group_name)) - - return _handle_resource_not_exists - - -def _get_thread_count(): - return 5 # don't increase too much till https://github.com/Azure/msrestazure-for-python/issues/6 is fixed - - -def load_images_thru_services(cli_ctx, publisher, offer, sku, location, edge_zone, architecture): - from concurrent.futures import ThreadPoolExecutor, as_completed - VMImage = import_aaz_by_profile(cli_ctx.cloud.profile, "vm.image") - - VMImageListPublishers = VMImage.ListPublishers - VMImageListOffers = VMImage.ListOffers - VMImageListSkus = VMImage.ListSkus - VMImageList = VMImage.List - - all_images = [] - if location is None: - location = get_one_of_subscription_locations(cli_ctx) - - def _load_images_from_publisher(publisher): - from azure.core.exceptions import ResourceNotFoundError - try: - offers = VMImageListOffers(cli_ctx=cli_ctx)(command_args={ - 'location': location, - 'publisher': publisher, - }) - except ResourceNotFoundError as e: - logger.warning(str(e)) - return - if offer: - offers = [o for o in offers if _matched(offer, o['name'])] - for o in offers: - try: - skus = VMImageListSkus(cli_ctx=cli_ctx)(command_args={ - 'location': location, - 'publisher': publisher, - 'offer': o['name'] - }) - except ResourceNotFoundError as e: - logger.warning(str(e)) - continue - if sku: - skus = [s for s in skus if _matched(sku, s['name'])] - for s in skus: - try: - expand = "properties/imageDeprecationStatus" - images = VMImageList(cli_ctx=cli_ctx)(command_args={ - 'location': location, - 'publisher': publisher, - 'offer': o['name'], - 'sku': s['name'], - 'expand': expand, - }) - except ResourceNotFoundError as e: - logger.warning(str(e)) - continue - for i in images: - image_info = { - 'publisher': publisher, - 'offer': o['name'], - 'sku': s['name'], - 'version': i['name'], - 'architecture': i.get("properties", {}).get("architecture", None) or "", - 'imageDeprecationStatus': i.get("properties", {}).get("imageDeprecationStatus", {}) or "" - } - if edge_zone is not None: - image_info['edge_zone'] = edge_zone - if architecture and architecture != image_info['architecture']: - continue - all_images.append(image_info) - - publishers = VMImageListPublishers(cli_ctx=cli_ctx)(command_args={ - 'location': location, - }) - if publisher: - publishers = [p for p in publishers if _matched(publisher, p['name'])] - - publisher_num = len(publishers) - if publisher_num > 1: - with ThreadPoolExecutor(max_workers=_get_thread_count()) as executor: - tasks = [executor.submit(_load_images_from_publisher, p['name']) for p in publishers] - for t in as_completed(tasks): - t.result() # don't use the result but expose exceptions from the threads - elif publisher_num == 1: - _load_images_from_publisher(publishers[0]['name']) - - return all_images - - -def load_images_from_aliases_doc(cli_ctx, publisher=None, offer=None, sku=None, architecture=None): - import requests - from azure.cli.core.cloud import CloudEndpointNotSetException - from azure.cli.core.util import should_disable_connection_verify - from azure.cli.command_modules.vm._alias import alias_json - try: - target_url = cli_ctx.cloud.endpoints.vm_image_alias_doc - except CloudEndpointNotSetException: - logger.warning("'endpoint_vm_image_alias_doc' isn't configured. Please invoke 'az cloud update' to configure " - "it or use '--all' to retrieve images from server. Use local copy instead.") - dic = json.loads(alias_json) - else: - # under hack mode(say through proxies with unsigned cert), opt out the cert verification - try: - response = requests.get(target_url, verify=not should_disable_connection_verify()) - if response.status_code == 200: - dic = json.loads(response.content.decode()) - else: - logger.warning("Failed to retrieve image alias doc '%s'. Error: '%s'. Use local copy instead.", - target_url, response) - dic = json.loads(alias_json) - except requests.exceptions.ConnectionError: - logger.warning("Failed to retrieve image alias doc '%s'. Error: 'ConnectionError'. Use local copy instead.", - target_url) - dic = json.loads(alias_json) - try: - all_images = [] - result = dic['outputs']['aliases']['value'] - for v in result.values(): # loop around os - for alias, vv in v.items(): # loop around distros - all_images.append({ - 'urnAlias': alias, - 'publisher': vv['publisher'], - 'offer': vv['offer'], - 'sku': vv['sku'], - 'version': vv['version'], - 'architecture': vv['architecture'] - }) - - all_images = [i for i in all_images if (_matched(publisher, i['publisher']) and - _matched(offer, i['offer']) and - _matched(sku, i['sku']) and - _matched(architecture, i['architecture']))] - return all_images - except KeyError: - raise CLIError('Could not retrieve image list from {} or local copy'.format(target_url)) - - -def load_extension_images_thru_services(cli_ctx, publisher, name, version, location, - show_latest=False, partial_match=True): - from concurrent.futures import ThreadPoolExecutor, as_completed - from packaging.version import parse # pylint: disable=no-name-in-module,import-error - all_images = [] - client = _compute_client_factory(cli_ctx) - if location is None: - location = get_one_of_subscription_locations(cli_ctx) - - def _load_extension_images_from_publisher(publisher): - from azure.core.exceptions import ResourceNotFoundError - try: - types = client.virtual_machine_extension_images.list_types(location, publisher) - except ResourceNotFoundError as e: - # PIR image publishers might not have any extension images, exception could raise - logger.warning(str(e)) - types = [] - if name: - types = [t for t in types if _matched(name, t.name, partial_match)] - for t in types: - try: - versions = client.virtual_machine_extension_images.list_versions( - location, publisher, t.name) - except ResourceNotFoundError as e: - logger.warning(str(e)) - continue - if version: - versions = [v for v in versions if _matched(version, v.name, partial_match)] - - if show_latest: - # pylint: disable=no-member - versions.sort(key=lambda v: parse(v.name), reverse=True) - try: - all_images.append({ - 'publisher': publisher, - 'name': t.name, - 'version': versions[0].name}) - except IndexError: - pass # if no versions for this type continue to next type. - else: - for v in versions: - all_images.append({ - 'publisher': publisher, - 'name': t.name, - 'version': v.name}) - - publishers = client.virtual_machine_images.list_publishers(location=location) - if publisher: - publishers = [p for p in publishers if _matched(publisher, p.name, partial_match)] - - publisher_num = len(publishers) - if publisher_num > 1: - with ThreadPoolExecutor(max_workers=_get_thread_count()) as executor: - tasks = [executor.submit(_load_extension_images_from_publisher, - p.name) for p in publishers] - for t in as_completed(tasks): - t.result() # don't use the result but expose exceptions from the threads - elif publisher_num == 1: - _load_extension_images_from_publisher(publishers[0].name) - - return all_images - - -def get_vm_sizes(cli_ctx, location): - return list(_compute_client_factory(cli_ctx).virtual_machine_sizes.list(location)) - - -def _matched(pattern, string, partial_match=True): - if not pattern: - return True # empty pattern means wildcard-match - pattern, string = pattern.lower(), string.lower() - return pattern in string if partial_match else pattern == string - - -def _create_image_instance(publisher, offer, sku, version): - return { - 'publisher': publisher, - 'offer': offer, - 'sku': sku, - 'version': version - } - - -def _get_latest_image_version(cli_ctx, location, publisher, offer, sku, edge_zone=None): - from azure.cli.core.azclierror import InvalidArgumentValueError - if edge_zone is not None: - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.cli.core.profiles import ResourceType - edge_zone_client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machine_images_edge_zone - top_one = edge_zone_client.list(location, edge_zone, publisher, offer, sku, top=1, orderby='name desc') - if not top_one: - raise InvalidArgumentValueError("Can't resolve the version of '{}:{}:{}:{}'" - .format(publisher, offer, sku, edge_zone)) - else: - top_one = _compute_client_factory(cli_ctx).virtual_machine_images.list(location, - publisher, - offer, - sku, - top=1, - orderby='name desc') - if not top_one: - raise InvalidArgumentValueError("Can't resolve the version of '{}:{}:{}'".format(publisher, offer, sku)) - return top_one[0].name diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_client_factory.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_client_factory.py deleted file mode 100644 index 3a1e32b391a..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_client_factory.py +++ /dev/null @@ -1,175 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -def _compute_client_factory(cli_ctx, **kwargs): - from azure.cli.core.profiles import ResourceType - from azure.cli.core.commands.client_factory import get_mgmt_service_client - return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_COMPUTE, - subscription_id=kwargs.get('subscription_id'), - aux_subscriptions=kwargs.get('aux_subscriptions')) - - -def cf_vm(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machines - - -def cf_vm_ext(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_extensions - - -def cf_vm_ext_image(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_extension_images - - -def cf_vm_image(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_images - - -def cf_vm_image_term(cli_ctx, _): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.mgmt.marketplaceordering import MarketplaceOrderingAgreements - market_place_client = get_mgmt_service_client(cli_ctx, MarketplaceOrderingAgreements) - return market_place_client.marketplace_agreements - - -def cf_usage(cli_ctx, _): - return _compute_client_factory(cli_ctx).usage - - -def cf_vmss(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_scale_sets - - -def cf_vmss_vm(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_scale_set_vms - - -def cf_vm_sizes(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_sizes - - -def cf_disks(cli_ctx, _): - return _compute_client_factory(cli_ctx).disks - - -def cf_snapshots(cli_ctx, _): - return _compute_client_factory(cli_ctx).snapshots - - -def cf_disk_accesses(cli_ctx, _): - return _compute_client_factory(cli_ctx).disk_accesses - - -def cf_images(cli_ctx, _): - return _compute_client_factory(cli_ctx).images - - -def cf_run_commands(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_run_commands - - -def cf_vmss_run_commands(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_scale_set_vm_run_commands - - -def cf_rolling_upgrade_commands(cli_ctx, _): - return _compute_client_factory(cli_ctx).virtual_machine_scale_set_rolling_upgrades - - -def cf_galleries(cli_ctx, _): - return _compute_client_factory(cli_ctx).galleries - - -def cf_gallery_images(cli_ctx, _): - return _compute_client_factory(cli_ctx).gallery_images - - -def cf_gallery_image_versions(cli_ctx, _): - return _compute_client_factory(cli_ctx).gallery_image_versions - - -def cf_proximity_placement_groups(cli_ctx, _): - return _compute_client_factory(cli_ctx).proximity_placement_groups - - -def cf_dedicated_hosts(cli_ctx, _): - return _compute_client_factory(cli_ctx).dedicated_hosts - - -def cf_dedicated_host_groups(cli_ctx, _): - return _compute_client_factory(cli_ctx).dedicated_host_groups - - -def _log_analytics_client_factory(cli_ctx, subscription_id, *_): - from azure.mgmt.loganalytics import LogAnalyticsManagementClient - from azure.cli.core.commands.client_factory import get_mgmt_service_client - return get_mgmt_service_client(cli_ctx, LogAnalyticsManagementClient, subscription_id=subscription_id) - - -def cf_log_analytics(cli_ctx, subscription_id, *_): - return _log_analytics_client_factory(cli_ctx, subscription_id) - - -def cf_log_analytics_data_sources(cli_ctx, subscription_id, *_): - return _log_analytics_client_factory(cli_ctx, subscription_id).data_sources - - -def cf_log_analytics_data_plane(cli_ctx, _): - """Initialize Log Analytics data client for use with CLI.""" - from azure.monitor.query import LogsQueryClient - from azure.cli.core._profile import Profile - profile = Profile(cli_ctx=cli_ctx) - cred, _, _ = profile.get_login_credentials() - api_version = 'v1' - return LogsQueryClient(cred, endpoint=cli_ctx.cloud.endpoints.log_analytics_resource_id + '/' + api_version, - audience=cli_ctx.cloud.endpoints.log_analytics_resource_id) - - -def cf_vm_cl(cli_ctx, *_): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.mgmt.compute import ComputeManagementClient - return get_mgmt_service_client(cli_ctx, - ComputeManagementClient) - - -def cf_shared_galleries(cli_ctx, *_): - return cf_vm_cl(cli_ctx).shared_galleries - - -def cf_shared_gallery_image(cli_ctx, *_): - return cf_vm_cl(cli_ctx).shared_gallery_images - - -def cf_shared_gallery_image_version(cli_ctx, *_): - return cf_vm_cl(cli_ctx).shared_gallery_image_versions - - -def cf_community_gallery(cli_ctx, *_): - return cf_vm_cl(cli_ctx).community_galleries - - -def cf_community_gallery_image(cli_ctx, *_): - return cf_vm_cl(cli_ctx).community_gallery_images - - -def cf_community_gallery_image_version(cli_ctx, *_): - return cf_vm_cl(cli_ctx).community_gallery_image_versions - - -def cf_capacity_reservation_groups(cli_ctx, *_): - return cf_vm_cl(cli_ctx).capacity_reservation_groups - - -def cf_capacity_reservations(cli_ctx, *_): - return cf_vm_cl(cli_ctx).capacity_reservations - - -def cf_restore_point(cli_ctx, *_): - return cf_vm_cl(cli_ctx).restore_points - - -def cf_restore_point_collection(cli_ctx, *_): - return cf_vm_cl(cli_ctx).restore_point_collections diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_completers.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_completers.py deleted file mode 100644 index 5a3686822b5..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_completers.py +++ /dev/null @@ -1,34 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from azure.cli.command_modules.vm.azure_stack._actions import load_images_from_aliases_doc, get_vm_sizes -from azure.cli.core.commands.parameters import get_one_of_subscription_locations -from azure.cli.core.decorators import Completer - - -@Completer -def get_urn_aliases_completion_list(cmd, prefix, namespace): # pylint: disable=unused-argument - images = load_images_from_aliases_doc(cmd.cli_ctx) - return [i['urnAlias'] for i in images] - - -@Completer -def get_vm_size_completion_list(cmd, prefix, namespace): # pylint: disable=unused-argument - location = namespace.location - if not location: - location = get_one_of_subscription_locations(cmd.cli_ctx) - result = get_vm_sizes(cmd.cli_ctx, location) - return [r.name for r in result] - - -@Completer -def get_vm_run_command_completion_list(cmd, prefix, namespace): # pylint: disable=unused-argument - from ._client_factory import _compute_client_factory - try: - location = namespace.location - except AttributeError: - location = get_one_of_subscription_locations(cmd.cli_ctx) - result = _compute_client_factory(cmd.cli_ctx).virtual_machine_run_commands.list(location) - return [r.id for r in result] diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_constants.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_constants.py deleted file mode 100644 index 5b3ff503907..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_constants.py +++ /dev/null @@ -1,23 +0,0 @@ -# -------------------------------------------------------------------------- -# 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. -# -# Generation mode: Incremental -# -------------------------------------------------------------------------- - -UPGRADE_SECURITY_HINT = 'Consider upgrading security for your workloads using Azure Trusted Launch VMs. ' \ - 'To know more about Trusted Launch, please visit ' \ - 'https://aka.ms/TrustedLaunch.' - -TLAD_DEFAULT_CHANGE_MSG = 'Ignite (November) 2023 onwards "{}" command will deploy Gen2-Trusted ' \ - 'Launch VM by default. To know more about the default change and Trusted Launch, ' \ - 'please visit https://aka.ms/TLaD' - -# The `Standard` is used for backward compatibility to allow customers to keep their current behavior -# after changing the default values of `security_type` to Trusted Launch VMs in the future. -COMPATIBLE_SECURITY_TYPE_VALUE = 'Standard' diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_format.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_format.py deleted file mode 100644 index 9e18f21ead2..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_format.py +++ /dev/null @@ -1,166 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -def transform_ip_addresses(result): - from collections import OrderedDict - transformed = [] - for r in result: - network = r['virtualMachine']['network'] - public = network.get('publicIpAddresses') - public_ip_addresses = ','.join([p['ipAddress'] for p in public if p['ipAddress']]) if public else None - private = network.get('privateIpAddresses') - private_ip_addresses = ','.join(private) if private else None - entry = OrderedDict([('virtualMachine', r['virtualMachine']['name']), - ('publicIPAddresses', public_ip_addresses), - ('privateIPAddresses', private_ip_addresses)]) - transformed.append(entry) - - return transformed - - -def transform_vm(vm): - from collections import OrderedDict - result = OrderedDict([('name', vm['name']), - ('resourceGroup', vm['resourceGroup']), - ('powerState', vm.get('powerState')), - ('publicIps', vm.get('publicIps')), - ('fqdns', vm.get('fqdns')), - ('location', vm['location'])]) - if 'zones' in vm: - result['zones'] = ','.join(vm['zones']) if vm['zones'] else '' - return result - - -def transform_vm_create_output(result): - from azure.mgmt.core.tools import parse_resource_id - from collections import OrderedDict - try: - resource_group = getattr(result, 'resource_group', None) or parse_resource_id(result.id)['resource_group'] - output = OrderedDict([('id', result.id), - ('resourceGroup', resource_group), - ('powerState', result.power_state), - ('publicIpAddress', result.public_ips), - ('fqdns', result.fqdns), - ('privateIpAddress', result.private_ips), - ('macAddress', result.mac_addresses), - ('location', result.location)]) - if getattr(result, 'identity', None): - output['identity'] = result.identity - if hasattr(result, 'zones'): # output 'zones' column even the property value is None - output['zones'] = result.zones[0] if result.zones else '' - return output - except AttributeError: - from msrest.pipeline import ClientRawResponse - return None if isinstance(result, ClientRawResponse) else result - - -def transform_vm_usage_list(result): - result = list(result) - for item in result: - item.current_value = str(item.current_value) - item.limit = str(item.limit) - item.local_name = item.name.localized_value - return result - - -def transform_vm_list(vm_list): - return [transform_vm(v) for v in vm_list] - - -# flattern out important fields (single member arrays) to be displayed in the table output -def transform_sku_for_table_output(skus): - from collections import OrderedDict - result = [] - for k in skus: - order_dict = OrderedDict() - order_dict['resourceType'] = k['resourceType'] - order_dict['locations'] = str(k['locations']) if len(k['locations']) > 1 else k['locations'][0] - order_dict['name'] = k['name'] - if k.get('locationInfo'): - order_dict['zones'] = ','.join(sorted(k['locationInfo'][0].get('zones', []))) - else: - order_dict['zones'] = 'None' - if k['restrictions']: - reasons = [] - for x in k['restrictions']: - reason = x['reasonCode'] - if x['type']: - reason += ', type: ' + x['type'] - if x['restrictionInfo']['locations']: - reason += ', locations: ' + ','.join(x['restrictionInfo']['locations']) - if x['restrictionInfo'].get('zones', None): - reason += ', zones: ' + ','.join(x['restrictionInfo']['zones']) - reasons.append(reason) - order_dict['restrictions'] = str(reasons) if len(reasons) > 1 else reasons[0] - else: - order_dict['restrictions'] = 'None' - for k2 in order_dict: - order_dict[k2] = order_dict[k2] if order_dict[k2] is not None else 'None' - result.append(order_dict) - return result - - -transform_extension_show_table_output = '{Name:name, ProvisioningState:provisioningState, Publisher:publisher, ' \ - 'Version:typeHandlerVersion, AutoUpgradeMinorVersion:autoUpgradeMinorVersion}' - -transform_disk_create_table_output = '{Name:name, ResourceGroup:resourceGroup, Location:location, Zones: ' \ - '(!zones && \' \') || join(` `, zones), Sku:sku.name, OsType:osType, ' \ - 'SizeGb:diskSizeGb, ProvisioningState:provisioningState}' - -transform_disk_show_table_output = '{Name:name, ResourceGroup:resourceGroup, Location:location, Zones: ' \ - '(!zones && \' \') || join(` `, zones), Sku:sku.name, OsType:osType, ' \ - 'SizeGb:diskSizeGB, ProvisioningState:provisioningState}' - - -def get_vmss_table_output_transformer(loader, for_list=True): - transform = '{Name:name, ResourceGroup:resourceGroup, Location:location, $zone$Capacity:sku.capacity, ' \ - 'Overprovision:overprovision, UpgradePolicy:upgradePolicy.mode}' - transform = transform.replace('$zone$', 'Zones: (!zones && \' \') || join(\' \', zones), ' - if loader.supported_api_version(min_api='2017-03-30') else ' ') - return transform if not for_list else '[].' + transform - - -transform_vmss_list_with_zones_table_output = '[].{Name:name, ResourceGroup:resourceGroup, Location:location, ' \ - 'Zones: (!zones && \' \') || join(\' \', zones), ' \ - 'Capacity:sku.capacity, Overprovision:overprovision, ' \ - 'UpgradePolicy:upgradePolicy.mode}' - -transform_vmss_list_without_zones_table_output = '[].{Name:name, ResourceGroup:resourceGroup, Location:location, ' \ - 'Capacity:sku.capacity, Overprovision:overprovision, ' \ - 'UpgradePolicy:upgradePolicy.mode}' - - -def transform_vm_encryption_show_table_output(result): - from collections import OrderedDict - if result.get("status", []): - status_dict = result["status"][0] - return OrderedDict([("status", status_dict.get("displayStatus", "N/A")), - ("message", status_dict.get("message", "N/A"))]) - return result - - -def transform_log_analytics_query_output(result): - from collections import OrderedDict - tables_output = [] - - def _transform_query_output(table): - name = table.name - rows = table.rows - column_names = table.columns - table_output = [] - for row in rows: - item = OrderedDict() - item['TableName'] = name - for index, value in enumerate(row): - item[column_names[index]] = str(value) - table_output.append(item) - return table_output - - for table in result.tables: - table_output = _transform_query_output(table) - tables_output.extend(table_output) - - return tables_output diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_image_builder.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_image_builder.py deleted file mode 100644 index fa74022baf7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_image_builder.py +++ /dev/null @@ -1,1011 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# TODO refactor out _image_builder commands. -# i.e something like image_builder/_client_factory image_builder/commands.py image_builder/_params.py -import os -import re -import json -import traceback -from enum import Enum - -from urllib.parse import urlparse - -import requests - -from knack.util import CLIError -from knack.log import get_logger - -from azure.mgmt.core.tools import is_valid_resource_id, resource_id, parse_resource_id - -from azure.core.exceptions import HttpResponseError - -from azure.cli.core.commands import cached_get, cached_put, LongRunningOperation -from azure.cli.core.commands.client_factory import get_subscription_id -from azure.cli.core.commands.validators import get_default_location_from_resource_group, validate_tags -from azure.cli.core.azclierror import RequiredArgumentMissingError, ResourceNotFoundError - -from azure.cli.command_modules.vm.azure_stack._client_factory import _compute_client_factory -from azure.cli.command_modules.vm.azure_stack._validators import _get_resource_id - -logger = get_logger(__name__) - - -class _SourceType(Enum): - PLATFORM_IMAGE = "PlatformImage" - ISO_URI = "ISO" - MANAGED_IMAGE = "ManagedImage" - SIG_VERSION = "SharedImageVersion" - - -class _DestType(Enum): - MANAGED_IMAGE = 1 - SHARED_IMAGE_GALLERY = 2 - - -class ScriptType(Enum): - SHELL = "shell" - POWERSHELL = "powershell" - WINDOWS_RESTART = "windows-restart" - WINDOWS_UPDATE = "windows-update" - FILE = "file" - - -class GalleryImageReferenceType(Enum): - COMPUTE = (0, 'id') - COMMUNITY = (1, 'communityGalleryImageId') - SHARED = (2, 'sharedGalleryImageId') - - def __init__(self, index, backend_key): - self.index = index - self.backend_key = backend_key - - -# region Client Factories - -def image_builder_client_factory(cli_ctx, _): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.mgmt.imagebuilder import ImageBuilderClient - client = get_mgmt_service_client(cli_ctx, ImageBuilderClient) - return client - - -def cf_img_bldr_image_templates(cli_ctx, _): - return image_builder_client_factory(cli_ctx, _).virtual_machine_image_templates - -# endregion - - -def _no_white_space_or_err(words): - for char in words: - if char.isspace(): - raise CLIError("Error: White space in {}".format(words)) - - -def _require_defer(cmd): - use_cache = cmd.cli_ctx.data.get('_cache', False) - if not use_cache: - raise CLIError("This command requires --defer") - - -def patch_image_template(cli_ctx, resource_group_name, image_template_name, image_template_update): - client = image_builder_client_factory(cli_ctx, '') - poller = client.virtual_machine_image_templates.begin_update(resource_group_name, image_template_name, - image_template_update) - return LongRunningOperation(cli_ctx)(poller) - - -def _parse_script(script_str): - script_name = script_str - script = {"script": script_str, "name": script_name, "type": None} - if urlparse(script_str).scheme and "://" in script_str: - _, script_name = script_str.rsplit("/", 1) - script["name"] = script_name - script["is_url"] = True - else: - raise CLIError("Expected a url, got: {}".format(script_str)) - - if script_str.lower().endswith(".sh"): - script["type"] = ScriptType.SHELL - elif script_str.lower().endswith(".ps1"): - script["type"] = ScriptType.POWERSHELL - - return script - - -def _parse_image_destination(cmd, rg, destination, is_shared_image): - if any([not destination, "=" not in destination]): - raise CLIError("Invalid Format: the given image destination {} must contain the '=' delimiter." - .format(destination)) - - rid, location = destination.rsplit("=", 1) - if not rid or not location: - raise CLIError("Invalid Format: destination {} should have format 'destination=location'.".format(destination)) - - _no_white_space_or_err(rid) - - result = None - if is_shared_image: - if not is_valid_resource_id(rid): - if "/" not in rid: - raise CLIError("Invalid Format: {} must have a shared image gallery name and definition. " - "They must be delimited by a '/'.".format(rid)) - - sig_name, sig_def = rid.rsplit("/", 1) - - rid = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=rg, - namespace='Microsoft.Compute', - type='galleries', name=sig_name, - child_type_1='images', child_name_1=sig_def - ) - - result = rid, location.split(",") - else: - if not is_valid_resource_id(rid): - rid = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=rg, - namespace='Microsoft.Compute', type='images', - name=rid - ) - - result = rid, location - - return result - - -def _validate_location(location, location_names, location_display_names): - if ' ' in location: - # if display name is provided, attempt to convert to short form name - location = next((name for name in location_display_names if name.lower() == location.lower()), location) - - if location.lower() not in [location_name.lower() for location_name in location_names]: - raise CLIError("Location {} is not a valid subscription location. " - "Use one from `az account list-locations`.".format(location)) - - return location - - -def process_image_template_create_namespace(cmd, namespace): # pylint: disable=too-many-locals, too-many-branches, too-many-statements - if namespace.image_template is not None: - return - - from azure.cli.core.commands.parameters import get_subscription_locations - - source = None - scripts = [] - - # default location to RG location. - if not namespace.location: - get_default_location_from_resource_group(cmd, namespace) - - # validate tags. - validate_tags(namespace) - - # Validate and parse scripts - if namespace.scripts: - for ns_script in namespace.scripts: - scripts.append(_parse_script(ns_script)) - - # Validate and parse destination and locations - destinations = [] - subscription_locations = get_subscription_locations(cmd.cli_ctx) - location_names = [location.name for location in subscription_locations] - location_display_names = [location.display_name for location in subscription_locations] - - if namespace.managed_image_destinations: - for dest in namespace.managed_image_destinations: - rid, location = _parse_image_destination(cmd, namespace.resource_group_name, dest, is_shared_image=False) - location = _validate_location(location, location_names, location_display_names) - destinations.append((_DestType.MANAGED_IMAGE, rid, location)) - - if namespace.shared_image_destinations: - for dest in namespace.shared_image_destinations: - rid, locations = _parse_image_destination(cmd, namespace.resource_group_name, dest, is_shared_image=True) - locations = [_validate_location(location, location_names, location_display_names) for location in locations] - destinations.append((_DestType.SHARED_IMAGE_GALLERY, rid, locations)) - - # Validate and parse source image - # 1 - check if source is a URN. A urn e.g "Canonical:UbuntuServer:18.04-LTS:latest" - urn_match = re.match('([^:]*):([^:]*):([^:]*):([^:]*)', namespace.source) - if urn_match: # if platform image urn - source = { - 'publisher': urn_match.group(1), - 'offer': urn_match.group(2), - 'sku': urn_match.group(3), - 'version': urn_match.group(4), - 'type': _SourceType.PLATFORM_IMAGE - } - - likely_linux = bool("windows" not in source["offer"].lower() and "windows" not in source["sku"].lower()) - - logger.info("%s looks like a platform image URN", namespace.source) - - # 2 - check if a fully-qualified ID (assumes it is an image ID) - elif is_valid_resource_id(namespace.source): - - parsed = parse_resource_id(namespace.source) - image_type = parsed.get('type') - image_resource_type = parsed.get('type') - - if not image_type: - pass - - elif image_type.lower() == 'images': - source = { - 'image_id': namespace.source, - 'type': _SourceType.MANAGED_IMAGE - } - logger.info("%s looks like a managed image id.", namespace.source) - - elif image_type == "galleries" and image_resource_type: - source = { - 'image_version_id': namespace.source, - 'type': _SourceType.SIG_VERSION - } - logger.info("%s looks like a shared image version id.", namespace.source) - - # 3 - check if source is a Redhat iso uri. If so a checksum must be provided. - elif urlparse(namespace.source).scheme and "://" in namespace.source and ".iso" in namespace.source.lower(): - if not namespace.checksum: - raise CLIError("Must provide a checksum for source uri: {}".format(namespace.source)) - source = { - 'source_uri': namespace.source, - 'sha256_checksum': namespace.checksum, - 'type': _SourceType.ISO_URI - } - likely_linux = True - - logger.info("%s looks like a RedHat iso uri.", namespace.source) - - # 4 - check if source is a urn alias from the vmImageAliasDoc endpoint. See "az cloud show" - if not source: - from azure.cli.command_modules.vm.azure_stack._actions import load_images_from_aliases_doc - images = load_images_from_aliases_doc(cmd.cli_ctx) - matched = next((x for x in images if x['urnAlias'].lower() == namespace.source.lower()), None) - if matched: - source = { - 'publisher': matched['publisher'], - 'offer': matched['offer'], - 'sku': matched['sku'], - 'version': matched['version'], - 'type': _SourceType.PLATFORM_IMAGE - } - - if "windows" not in source["offer"].lower() and "windows" not in source["sku"].lower(): - likely_linux = True - - logger.info("%s looks like a platform image alias.", namespace.source) - - # 5 - check if source is an existing managed disk image resource - if not source: - compute_client = _compute_client_factory(cmd.cli_ctx) - try: - image_name = namespace.source - compute_client.images.get(namespace.resource_group_name, namespace.source) - namespace.source = _get_resource_id(cmd.cli_ctx, namespace.source, namespace.resource_group_name, - 'images', 'Microsoft.Compute') - source = { - 'image_id': namespace.source, - 'type': _SourceType.MANAGED_IMAGE - } - - logger.info("%s, looks like a managed image name. Using resource ID: %s", image_name, namespace.source) # pylint: disable=line-too-long - except HttpResponseError: - pass - - if not source: - err = 'Invalid image "{}". Use a valid image URN, managed image name or ID, ISO URI, ' \ - 'or pick a platform image alias from {}.\nSee vm create -h for more information on specifying an image.'\ - .format(namespace.source, ", ".join([x['urnAlias'] for x in images])) - raise CLIError(err) - - for script in scripts: - if script["type"] is None: - try: - script["type"] = ScriptType.SHELL if likely_linux else ScriptType.POWERSHELL # pylint: disable=used-before-assignment - logger.info("For script %s, likely linux is %s.", script["script"], likely_linux) - except NameError: - raise CLIError("Unable to infer the type of script {}.".format(script["script"])) - - namespace.source_dict = source - namespace.scripts_list = scripts - namespace.destinations_lists = destinations - - -# first argument is `cmd`, but it is unused. Feel free to substitute it in. -def process_img_tmpl_customizer_add_namespace(cmd, namespace): # pylint:disable=unused-argument - - if namespace.customizer_type.lower() in [ScriptType.SHELL.value.lower(), ScriptType.POWERSHELL.value.lower()]: # pylint:disable=no-member, line-too-long - if not (namespace.script_url or namespace.inline_script): - raise CLIError("A script must be provided if the customizer type is one of: {} {}" - .format(ScriptType.SHELL.value, ScriptType.POWERSHELL.value)) - - if namespace.script_url and namespace.inline_script: - raise CLIError("Cannot supply both script url and inline script.") - - elif namespace.customizer_type.lower() == ScriptType.WINDOWS_RESTART.value.lower(): # pylint:disable=no-member - if namespace.script_url or namespace.inline_script: - logger.warning("Ignoring the supplied script as scripts are not used for Windows Restart.") - - -def process_img_tmpl_output_add_namespace(cmd, namespace): - from azure.cli.core.commands.parameters import get_subscription_locations - - outputs = [output for output in [namespace.managed_image, namespace.gallery_image_definition, namespace.is_vhd] if output] # pylint:disable=line-too-long - - if len(outputs) != 1: - err = "Supplied outputs: {}".format(outputs) - logger.debug(err) - raise CLIError("Usage error: must supply exactly one destination type to add. Supplied {}".format(len(outputs))) - - if namespace.managed_image: - if not is_valid_resource_id(namespace.managed_image): - namespace.managed_image = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=namespace.resource_group_name, - namespace='Microsoft.Compute', type='images', - name=namespace.managed_image - ) - - if namespace.gallery_image_definition: - if not is_valid_resource_id(namespace.gallery_image_definition): - if not namespace.gallery_name: - raise CLIError("Usage error: gallery image definition is a name and not an ID.") - - namespace.gallery_image_definition = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=namespace.resource_group_name, - namespace='Microsoft.Compute', - type='galleries', name=namespace.gallery_name, - child_type_1='images', child_name_1=namespace.gallery_image_definition - ) - - if namespace.is_vhd and not namespace.output_name: - raise CLIError("Usage error: If --is-vhd is used, a run output name must be provided via --output-name.") - - subscription_locations = get_subscription_locations(cmd.cli_ctx) - location_names = [location.name for location in subscription_locations] - location_display_names = [location.display_name for location in subscription_locations] - - if namespace.managed_image_location: - namespace.managed_image_location = _validate_location(namespace.managed_image_location, - location_names, location_display_names) - - if namespace.gallery_replication_regions: - processed_regions = [] - for loc in namespace.gallery_replication_regions: - processed_regions.append(_validate_location(loc, location_names, location_display_names)) - namespace.gallery_replication_regions = processed_regions - - # get default location from resource group - if not any([namespace.managed_image_location, namespace.gallery_replication_regions]) and hasattr(namespace, 'location'): # pylint: disable=line-too-long - # store location in namespace.location for use in custom method. - get_default_location_from_resource_group(cmd, namespace) - - # validate tags. - validate_tags(namespace) - - -# region Custom Commands - -def create_image_template( # pylint: disable=too-many-locals, too-many-branches, too-many-statements, unused-argument - cmd, client, resource_group_name, image_template_name, location=None, - source_dict=None, scripts_list=None, destinations_lists=None, build_timeout=None, tags=None, - source=None, scripts=None, checksum=None, managed_image_destinations=None, - shared_image_destinations=None, no_wait=False, image_template=None, identity=None, - vm_size=None, os_disk_size=None, vnet=None, subnet=None, proxy_vm_size=None, build_vm_identities=None, - staging_resource_group=None, validator=None): - from azure.mgmt.imagebuilder.models import (ImageTemplate, ImageTemplateSharedImageVersionSource, - ImageTemplatePlatformImageSource, ImageTemplateManagedImageSource, - ImageTemplateShellCustomizer, ImageTemplatePowerShellCustomizer, - ImageTemplateManagedImageDistributor, - ImageTemplateSharedImageDistributor, ImageTemplateIdentity, - UserAssignedIdentity, ImageTemplateVmProfile, VirtualNetworkConfig, - ImageTemplatePropertiesValidate, ImageTemplateInVMValidator) - - if image_template is not None: - logger.warning('You are using --image-template. All other parameters will be ignored.') - if os.path.exists(image_template): - # Local file - with open(image_template) as f: - content = f.read() - else: - # It should be an URL - msg = '\nusage error: --image-template is not a correct local path or URL' - try: - r = requests.get(image_template) - except Exception: - raise CLIError(traceback.format_exc() + msg) - if r.status_code != 200: - raise CLIError(traceback.format_exc() + msg) - content = r.content - - try: - obj = json.loads(content) - except json.JSONDecodeError: - raise CLIError(traceback.format_exc() + - '\nusage error: Content of --image-template is not a valid JSON string') - content = {} - if 'properties' in obj: - content = obj['properties'] - if 'location' in obj: - content['location'] = obj['location'] - if 'tags' in obj: - content['tags'] = obj['tags'] - if 'identity' in obj: - content['identity'] = obj['identity'] - if 'staging_resource_group' in obj: - content['staging_resource_group'] = obj['staging_resource_group'] - if 'validate' in obj: - content['validate'] = obj['validate'] - return client.virtual_machine_image_templates.begin_create_or_update( - parameters=content, resource_group_name=resource_group_name, image_template_name=image_template_name) - - template_source, template_scripts, template_destinations = None, [], [] - - # create image template source settings - if source_dict['type'] == _SourceType.PLATFORM_IMAGE: - template_source = ImageTemplatePlatformImageSource(**source_dict) - elif source_dict['type'] == _SourceType.ISO_URI: - # It was supported before but is removed in the current service version. - raise CLIError('usage error: Source type ISO URI is not supported.') - elif source_dict['type'] == _SourceType.MANAGED_IMAGE: - template_source = ImageTemplateManagedImageSource(**source_dict) - elif source_dict['type'] == _SourceType.SIG_VERSION: - template_source = ImageTemplateSharedImageVersionSource(**source_dict) - - # create image template customizer settings - # Script structure can be found in _parse_script's function definition - for script in scripts_list: - script.pop("is_url") - script["script_uri"] = script.pop("script") - - if script["type"] == ScriptType.SHELL: - template_scripts.append(ImageTemplateShellCustomizer(**script)) - elif script["type"] == ScriptType.POWERSHELL: - template_scripts.append(ImageTemplatePowerShellCustomizer(**script)) - else: # Should never happen - logger.debug("Script %s has type %s", script["script"], script["type"]) - raise CLIError("Script {} has an invalid type.".format(script["script"])) - - # create image template distribution / destination settings - for dest_type, rid, loc_info in destinations_lists: - parsed = parse_resource_id(rid) - if dest_type == _DestType.MANAGED_IMAGE: - template_destinations.append(ImageTemplateManagedImageDistributor( - image_id=rid, location=loc_info, run_output_name=parsed['name'])) - elif dest_type == _DestType.SHARED_IMAGE_GALLERY: - template_destinations.append(ImageTemplateSharedImageDistributor( - gallery_image_id=rid, replication_regions=loc_info, run_output_name=parsed['child_name_1'])) - else: - logger.info("No applicable destination found for destination %s", str(tuple([dest_type, rid, loc_info]))) - - # Identity - identity_body = None - if identity is not None: - subscription_id = get_subscription_id(cmd.cli_ctx) - user_assigned_identities = {} - for ide in identity: - if not is_valid_resource_id(ide): - ide = resource_id(subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.ManagedIdentity', type='userAssignedIdentities', name=ide) - user_assigned_identities[ide] = UserAssignedIdentity() # pylint: disable=line-too-long - identity_body = ImageTemplateIdentity(type='UserAssigned', user_assigned_identities=user_assigned_identities) - - # VM profile - vnet_config = None - if vnet or subnet: - if not is_valid_resource_id(subnet): - subscription_id = get_subscription_id(cmd.cli_ctx) - subnet = resource_id(subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Network', type='virtualNetworks', name=vnet, - child_type_1='subnets', child_name_1=subnet) - vnet_config = VirtualNetworkConfig(subnet_id=subnet) - if proxy_vm_size is not None: - if subnet is not None: - vnet_config = VirtualNetworkConfig(subnet_id=subnet, proxy_vm_size=proxy_vm_size) - else: - raise RequiredArgumentMissingError( - 'Usage error: --proxy-vm-size is only configurable when --subnet is specified.') - vm_profile = ImageTemplateVmProfile(vm_size=vm_size, os_disk_size_gb=os_disk_size, user_assigned_identities=build_vm_identities, vnet_config=vnet_config) # pylint: disable=line-too-long - - validate = None - if validator: - in_vm_validations = [] - for item in validator: - validator_item = ImageTemplateInVMValidator() - validator_item.type = item - in_vm_validations.append(validator_item) - validate = ImageTemplatePropertiesValidate(in_vm_validations=in_vm_validations) - - image_template = ImageTemplate(source=template_source, distribute=template_destinations, - location=location, build_timeout_in_minutes=build_timeout, tags=(tags or {}), - identity=identity_body, vm_profile=vm_profile, validate=validate, - staging_resource_group=staging_resource_group) - - if len(template_scripts) > 0: - image_template.customize = template_scripts - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=image_template, - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def assign_template_identity(cmd, client, resource_group_name, image_template_name, user_assigned=None): - from azure.mgmt.imagebuilder.models import (ImageTemplateIdentity, ImageTemplateUpdateParameters, - UserAssignedIdentity) - - from azure.cli.core.commands.arm import assign_identity as assign_identity_helper - - def getter(): - return client.virtual_machine_image_templates.get(resource_group_name, image_template_name) - - def setter(image_template): - existing_user_identities = set() - if image_template.identity is not None: - existing_user_identities = {x.lower() for x in - list((image_template.identity.user_assigned_identities or {}).keys())} - - subscription_id = get_subscription_id(cmd.cli_ctx) - add_user_assigned = set() - for ide in user_assigned: - if not is_valid_resource_id(ide): - ide = resource_id(subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.ManagedIdentity', type='userAssignedIdentities', name=ide) - add_user_assigned.add(ide.lower()) - - updated_user_assigned = list(existing_user_identities.union(add_user_assigned)) - - default_user_identity = UserAssignedIdentity() # pylint: disable=line-too-long - user_assigned_identities = dict.fromkeys(updated_user_assigned, default_user_identity) - - image_template_identity = ImageTemplateIdentity(type='UserAssigned', - user_assigned_identities=user_assigned_identities) - image_template_update = ImageTemplateUpdateParameters() - image_template_update.identity = image_template_identity - return patch_image_template(cmd.cli_ctx, resource_group_name, image_template_name, image_template_update) - - image_template = assign_identity_helper(cmd.cli_ctx, getter, setter) - return image_template.identity - - -def remove_template_identity(cmd, client, resource_group_name, image_template_name, user_assigned=None): - from azure.mgmt.imagebuilder.models import ImageTemplateUpdateParameters - - def getter(): - return client.virtual_machine_image_templates.get(resource_group_name, image_template_name) - - def setter(resource_group_name, image_template_name, image_template): - image_template_update = ImageTemplateUpdateParameters(identity=image_template.identity) - return client.virtual_machine_image_templates.begin_update(resource_group_name, image_template_name, - image_template_update) - - return _remove_template_identity(cmd, resource_group_name, image_template_name, user_assigned, getter, setter) - - -def _remove_template_identity(cmd, resource_group_name, image_template_name, user_assigned, getter, setter): - resource = getter() - if resource is None or resource.identity is None: - return None - - user_identities_to_remove = [] - if user_assigned is not None: - existing_user_identities = {x.lower() for x in list((resource.identity.user_assigned_identities or {}).keys())} - # all user assigned identities will be removed if the length of user_assigned is 0, - # otherwise the specified identity - subscription_id = get_subscription_id(cmd.cli_ctx) - user_identities_to_remove = existing_user_identities if len(user_assigned) == 0 else set() - for ide in user_assigned: - if not is_valid_resource_id(ide): - ide = resource_id(subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.ManagedIdentity', type='userAssignedIdentities', name=ide) - user_identities_to_remove.add(ide.lower()) - - non_existing = user_identities_to_remove.difference(existing_user_identities) - if non_existing: - from azure.cli.core.azclierror import InvalidArgumentValueError - raise InvalidArgumentValueError("'{}' are not associated with '{}', please provide existing user managed " - "identities".format(','.join(non_existing), image_template_name)) - - if not list(existing_user_identities - user_identities_to_remove): - resource.identity.type = "None" - resource.identity.user_assigned_identities = None - - if user_identities_to_remove and resource.identity.type != "None": - resource.identity.user_assigned_identities = {} - for identity in user_identities_to_remove: - resource.identity.user_assigned_identities[identity] = None - - result = LongRunningOperation(cmd.cli_ctx)(setter(resource_group_name, image_template_name, resource)) - return result.identity - - -def show_template_identity(client, resource_group_name, image_template_name): - return client.virtual_machine_image_templates.get(resource_group_name, image_template_name).identity - - -def list_image_templates(client, resource_group_name=None): - if resource_group_name: - return client.virtual_machine_image_templates.list_by_resource_group(resource_group_name) - return client.virtual_machine_image_templates.list() - - -def show_build_output(client, resource_group_name, image_template_name, output_name=None): - if output_name: - return client.virtual_machine_image_templates.get_run_output(resource_group_name, image_template_name, output_name) # pylint: disable=line-too-long - return client.virtual_machine_image_templates.list_run_outputs(resource_group_name, image_template_name) - - -def add_template_output(cmd, client, resource_group_name, image_template_name, gallery_name=None, location=None, # pylint: disable=line-too-long, unused-argument - output_name=None, is_vhd=None, vhd_uri=None, tags=None, - gallery_image_definition=None, gallery_replication_regions=None, - managed_image=None, managed_image_location=None, versioning=None): # pylint: disable=line-too-long, unused-argument - - _require_defer(cmd) - - from azure.mgmt.imagebuilder.models import (ImageTemplateManagedImageDistributor, ImageTemplateVhdDistributor, - ImageTemplateSharedImageDistributor, DistributeVersioner) - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - distributor = None - - if managed_image: - parsed = parse_resource_id(managed_image) - distributor = ImageTemplateManagedImageDistributor( - run_output_name=output_name or parsed['name'], - image_id=managed_image, location=managed_image_location or location) - elif gallery_image_definition: - parsed = parse_resource_id(gallery_image_definition) - distributor = ImageTemplateSharedImageDistributor( - run_output_name=output_name or parsed['child_name_1'], gallery_image_id=gallery_image_definition, - replication_regions=gallery_replication_regions or [location]) - if versioning: - versioner = DistributeVersioner() - versioner.scheme = versioning - distributor.versioning = versioner - elif is_vhd: - distributor = ImageTemplateVhdDistributor(run_output_name=output_name, uri=vhd_uri) - - if distributor: - distributor.artifact_tags = tags or {} - - if existing_image_template.distribute is None: - existing_image_template.distribute = [] - else: - for existing_distributor in existing_image_template.distribute: - if existing_distributor.run_output_name == distributor.run_output_name: - raise CLIError("Output with output name {} already exists in image template {}." - .format(distributor.run_output_name.lower(), image_template_name)) - - existing_image_template.distribute.append(distributor) - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def remove_template_output(cmd, client, resource_group_name, image_template_name, output_name): - _require_defer(cmd) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - if not existing_image_template.distribute: - raise CLIError("No outputs to remove.") - - new_distribute = [] - for existing_distributor in existing_image_template.distribute: - if existing_distributor.run_output_name.lower() == output_name.lower(): - continue - new_distribute.append(existing_distributor) - - if len(new_distribute) == len(existing_image_template.distribute): - raise CLIError("Output with output name {} not in image template distribute list.".format(output_name)) - - existing_image_template.distribute = new_distribute - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def clear_template_output(cmd, client, resource_group_name, image_template_name): - _require_defer(cmd) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - if not existing_image_template.distribute: - raise CLIError("No outputs to remove.") - - existing_image_template.distribute = [] - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def set_template_output_versioning(cmd, client, resource_group_name, image_template_name, output_name, scheme, major=None): # pylint: disable=line-too-long, unused-argument - - _require_defer(cmd) - - from azure.mgmt.imagebuilder.models import DistributeVersionerLatest, DistributeVersionerSource - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - distribute = [distribute for distribute in existing_image_template.distribute - if distribute.run_output_name.lower() == output_name.lower()] \ - if existing_image_template.distribute else [] - - if not distribute: - raise CLIError("Output with output name {} not in image template distribute list.".format(output_name)) - - if scheme == 'Latest': - distribute[0].versioning = DistributeVersionerLatest(scheme=scheme, major=major) - else: - distribute[0].versioning = DistributeVersionerSource(scheme=scheme) - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def remove_template_output_versioning(cmd, client, resource_group_name, image_template_name, output_name): - _require_defer(cmd) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - distribute = [distribute for distribute in existing_image_template.distribute - if distribute.run_output_name.lower() == output_name.lower()] \ - if existing_image_template.distribute else [] - - if not distribute: - raise CLIError("Output with output name {} not in image template distribute list.".format(output_name)) - - distribute[0].versioning = None - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def show_template_output_versioning(cmd, client, resource_group_name, image_template_name, output_name): - _require_defer(cmd) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - distribute = [distribute for distribute in existing_image_template.distribute - if distribute.run_output_name.lower() == output_name.lower()] \ - if existing_image_template.distribute else [] - - if not distribute: - raise CLIError("Output with output name {} not in image template distribute list.".format(output_name)) - - return distribute[0].versioning - - -def add_template_customizer(cmd, client, resource_group_name, image_template_name, customizer_name, customizer_type, - script_url=None, inline_script=None, valid_exit_codes=None, - restart_command=None, restart_check_command=None, restart_timeout=None, - file_source=None, dest_path=None, search_criteria=None, filters=None, update_limit=None): - _require_defer(cmd) - - from azure.mgmt.imagebuilder.models import (ImageTemplateShellCustomizer, ImageTemplatePowerShellCustomizer, - ImageTemplateRestartCustomizer, ImageTemplateFileCustomizer, - ImageTemplateWindowsUpdateCustomizer) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - if existing_image_template.customize is None: - existing_image_template.customize = [] - else: - for existing_customizer in existing_image_template.customize: - if existing_customizer.name == customizer_name: - raise CLIError("Output with output name {} already exists in image template {}." - .format(customizer_name, image_template_name)) - - new_customizer = None - - if customizer_type.lower() == ScriptType.SHELL.value.lower(): # pylint:disable=no-member - new_customizer = ImageTemplateShellCustomizer(name=customizer_name, script_uri=script_url, inline=inline_script) - elif customizer_type.lower() == ScriptType.POWERSHELL.value.lower(): # pylint:disable=no-member - new_customizer = ImageTemplatePowerShellCustomizer(name=customizer_name, script_uri=script_url, - inline=inline_script, valid_exit_codes=valid_exit_codes) - elif customizer_type.lower() == ScriptType.WINDOWS_RESTART.value.lower(): # pylint:disable=no-member - new_customizer = ImageTemplateRestartCustomizer(name=customizer_name, restart_command=restart_command, - restart_check_command=restart_check_command, - restart_timeout=restart_timeout) - elif customizer_type.lower() == ScriptType.FILE.value.lower(): # pylint:disable=no-member - new_customizer = ImageTemplateFileCustomizer(name=customizer_name, source_uri=file_source, - destination=dest_path) - elif customizer_type.lower() == ScriptType.WINDOWS_UPDATE.value.lower(): - new_customizer = ImageTemplateWindowsUpdateCustomizer(name=customizer_name, search_criteria=search_criteria, - filters=filters, update_limit=update_limit) - - if not new_customizer: - raise CLIError("Cannot determine customizer from type {}.".format(customizer_type)) - - existing_image_template.customize.append(new_customizer) - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def remove_template_customizer(cmd, client, resource_group_name, image_template_name, customizer_name): - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - _require_defer(cmd) - - if not existing_image_template.customize: - raise CLIError("No customizers to remove.") - - new_customize = [] - for existing_customizer in existing_image_template.customize: - if existing_customizer.name == customizer_name: - continue - new_customize.append(existing_customizer) - - if len(new_customize) == len(existing_image_template.customize): - raise CLIError("Customizer with name {} not in image template customizer list.".format(customizer_name)) - - existing_image_template.customize = new_customize - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def clear_template_customizer(cmd, client, resource_group_name, image_template_name): - _require_defer(cmd) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - if not existing_image_template.customize: - raise CLIError("No customizers to remove.") - - existing_image_template.customize = [] - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def add_template_validator(cmd, client, resource_group_name, image_template_name, - dis_on_failure=False, source_validation_only=False): - _require_defer(cmd) - from azure.mgmt.imagebuilder.models import ImageTemplatePropertiesValidate - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - if not existing_image_template.validate: - existing_image_template.validate = ImageTemplatePropertiesValidate( - continue_distribute_on_failure=dis_on_failure, source_validation_only=source_validation_only) - else: - existing_image_template.validate.continue_distribute_on_failure = dis_on_failure - existing_image_template.validate.source_validation_only = source_validation_only - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, - parameters=existing_image_template, resource_group_name=resource_group_name, - image_template_name=image_template_name) - - -def remove_template_validator(cmd, client, resource_group_name, image_template_name): - _require_defer(cmd) - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - if not existing_image_template.validate: - raise ResourceNotFoundError("No validate existing in this image template, no need to remove.") - - existing_image_template.validate = None - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def show_template_validator(cmd, client, resource_group_name, image_template_name): - _require_defer(cmd) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - return existing_image_template.validate - - -def add_or_update_template_optimizer(cmd, client, resource_group_name, image_template_name, enable_vm_boot=None): - _require_defer(cmd) - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - from azure.mgmt.imagebuilder.models import ImageTemplatePropertiesOptimize, ImageTemplatePropertiesOptimizeVmBoot - image_template_properties_optimize = existing_image_template.optimize or ImageTemplatePropertiesOptimize() - - if enable_vm_boot is not None: - state = "Enabled" if enable_vm_boot else "Disabled" - vm_boot = ImageTemplatePropertiesOptimizeVmBoot(state=state) - image_template_properties_optimize.vm_boot = vm_boot - existing_image_template.optimize = image_template_properties_optimize - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, - parameters=existing_image_template, resource_group_name=resource_group_name, - image_template_name=image_template_name) - - -def remove_template_optimizer(cmd, client, resource_group_name, image_template_name): - _require_defer(cmd) - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - if not existing_image_template.optimize: - raise ResourceNotFoundError("No optimize existing in this image template, no need to clear.") - - existing_image_template.optimize = None - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, parameters=existing_image_template, # pylint: disable=line-too-long - resource_group_name=resource_group_name, image_template_name=image_template_name) - - -def show_template_optimizer(cmd, client, resource_group_name, image_template_name): - _require_defer(cmd) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - return existing_image_template.optimize - - -def add_template_error_handler(cmd, client, resource_group_name, image_template_name, - on_customizer_error=None, on_validation_error=None): - _require_defer(cmd) - from azure.mgmt.imagebuilder.models import ImageTemplatePropertiesErrorHandling - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - if not existing_image_template.error_handling: - existing_image_template.error_handling = ImageTemplatePropertiesErrorHandling( - on_customizer_error=on_customizer_error, on_validation_error=on_validation_error - ) - else: - existing_image_template.error_handling.on_customizer_error = on_customizer_error - existing_image_template.error_handling.on_validation_error = on_validation_error - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, - parameters=existing_image_template, resource_group_name=resource_group_name, - image_template_name=image_template_name) - - -def remove_template_error_handler(cmd, client, resource_group_name, image_template_name): - _require_defer(cmd) - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - - if not existing_image_template.error_handling: - raise ResourceNotFoundError("No error handler existing in this image template, no need to clear.") - - existing_image_template.error_handling = None - - return cached_put(cmd, client.virtual_machine_image_templates.begin_create_or_update, - parameters=existing_image_template, resource_group_name=resource_group_name, - image_template_name=image_template_name) - - -def show_template_error_handler(cmd, client, resource_group_name, image_template_name): - _require_defer(cmd) - - existing_image_template = cached_get(cmd, client.virtual_machine_image_templates.get, - resource_group_name=resource_group_name, - image_template_name=image_template_name) - return existing_image_template.error_handling -# endregion diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_params.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_params.py deleted file mode 100644 index 36ac4d87309..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_params.py +++ /dev/null @@ -1,1550 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# pylint: disable=line-too-long, too-many-lines -from argcomplete.completers import FilesCompleter - -from knack.arguments import CLIArgumentType - -from azure.cli.core.profiles import ResourceType -from azure.cli.core.commands.parameters import get_datetime_type -from azure.cli.core.commands.validators import ( - get_default_location_from_resource_group, validate_file_or_dict) -from azure.cli.core.commands.parameters import ( - get_location_type, get_resource_name_completion_list, tags_type, get_three_state_flag, - file_type, get_enum_type, zone_type, zones_type) -from azure.cli.command_modules.vm.azure_stack._actions import _resource_not_exists -from azure.cli.command_modules.vm.azure_stack._completers import ( - get_urn_aliases_completion_list, get_vm_size_completion_list, get_vm_run_command_completion_list) -from azure.cli.command_modules.vm.azure_stack._constants import COMPATIBLE_SECURITY_TYPE_VALUE -from azure.cli.command_modules.vm.azure_stack._validators import ( - validate_nsg_name, validate_vm_nics, validate_vm_nic, validate_vmss_disk, - validate_asg_names_or_ids, validate_keyvault, _validate_proximity_placement_group, - validate_vm_name_for_monitor_metrics) - -from azure.cli.command_modules.vm.azure_stack._vm_utils import MSI_LOCAL_ID -from azure.cli.command_modules.vm.azure_stack._image_builder import ScriptType - -from azure.cli.command_modules.monitor.validators import validate_metric_dimension -from azure.cli.command_modules.monitor.actions import get_period_type - - -# pylint: disable=too-many-statements, too-many-branches, too-many-locals, too-many-lines -def load_arguments(self, _): - # Model imports - DiskStorageAccountTypes = self.get_models('DiskStorageAccountTypes', operation_group='disks') - SnapshotStorageAccountTypes = self.get_models('SnapshotStorageAccountTypes', operation_group='snapshots') - UpgradeMode, CachingTypes, OperatingSystemTypes = self.get_models('UpgradeMode', 'CachingTypes', 'OperatingSystemTypes') - HyperVGenerationTypes = self.get_models('HyperVGenerationTypes') - DedicatedHostLicenseTypes = self.get_models('DedicatedHostLicenseTypes') - OrchestrationServiceNames, OrchestrationServiceStateAction = self.get_models('OrchestrationServiceNames', 'OrchestrationServiceStateAction', operation_group='virtual_machine_scale_sets') - RebootSetting, VMGuestPatchClassificationWindows, VMGuestPatchClassificationLinux = self.get_models('VMGuestPatchRebootSetting', 'VMGuestPatchClassificationWindows', 'VMGuestPatchClassificationLinux') - ReplicationMode = self.get_models('ReplicationMode', operation_group='gallery_image_versions') - DiskControllerTypes = self.get_models('DiskControllerTypes', operation_group='virtual_machines') - - # REUSABLE ARGUMENT DEFINITIONS - name_arg_type = CLIArgumentType(options_list=['--name', '-n'], metavar='NAME') - multi_ids_type = CLIArgumentType(nargs='+') - existing_vm_name = CLIArgumentType(overrides=name_arg_type, - configured_default='vm', - help="The name of the Virtual Machine. You can configure the default using `az configure --defaults vm=`", - completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachines'), id_part='name') - existing_disk_name = CLIArgumentType(overrides=name_arg_type, help='The name of the managed disk', completer=get_resource_name_completion_list('Microsoft.Compute/disks'), id_part='name') - existing_snapshot_name = CLIArgumentType(overrides=name_arg_type, help='The name of the snapshot', completer=get_resource_name_completion_list('Microsoft.Compute/snapshots'), id_part='name') - vmss_name_type = CLIArgumentType(name_arg_type, - configured_default='vmss', - completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachineScaleSets'), - help="Scale set name. You can configure the default using `az configure --defaults vmss=`", - id_part='name') - - extension_instance_name_type = CLIArgumentType(help="Name of extension instance, which can be customized. Default: name of the extension.") - image_template_name_type = CLIArgumentType(overrides=name_arg_type, id_part='name') - ephemeral_placement_type = CLIArgumentType(options_list=['--ephemeral-os-disk-placement', '--ephemeral-placement'], arg_type=get_enum_type(self.get_models('DiffDiskPlacement')), min_api='2019-12-01') - - license_type = CLIArgumentType( - help="Specifies that the Windows image or disk was licensed on-premises. To enable Azure Hybrid Benefit for " - "Windows Server, use 'Windows_Server'. To enable Multi-tenant Hosting Rights for Windows 10, " - "use 'Windows_Client'. For more information see the Azure Windows VM online docs.", - arg_type=get_enum_type(['Windows_Server', 'Windows_Client', 'RHEL_BYOS', 'SLES_BYOS', 'RHEL_BASE', - 'RHEL_SAPAPPS', 'RHEL_SAPHA', 'RHEL_EUS', 'RHEL_BASESAPAPPS', 'RHEL_BASESAPHA', 'SLES_STANDARD', 'SLES', 'SLES_SAP', 'SLES_HPC', - 'None', 'RHEL_ELS_6', 'UBUNTU_PRO', 'UBUNTU'])) - - # StorageAccountTypes renamed to DiskStorageAccountTypes in 2018_06_01 of azure-mgmt-compute - DiskStorageAccountTypes = DiskStorageAccountTypes or self.get_models('StorageAccountTypes') - - if DiskStorageAccountTypes: - disk_sku = CLIArgumentType(arg_type=get_enum_type(DiskStorageAccountTypes)) - else: - # StorageAccountTypes introduced in api version 2016_04_30_preview of Resource.MGMT.Compute package.. - # However, 2017-03-09-profile targets version 2016-03-30 of compute package. - disk_sku = CLIArgumentType(arg_type=get_enum_type(['Premium_LRS', 'Standard_LRS'])) - - if SnapshotStorageAccountTypes: - snapshot_sku = CLIArgumentType(arg_type=get_enum_type(SnapshotStorageAccountTypes)) - else: - # SnapshotStorageAccountTypes introduced in api version 2018_04_01 of Resource.MGMT.Compute package.. - # However, 2017-03-09-profile targets version 2016-03-30 of compute package. - snapshot_sku = CLIArgumentType(arg_type=get_enum_type(['Premium_LRS', 'Standard_LRS'])) - - # special case for `network nic scale-set list` command alias - with self.argument_context('network nic scale-set list') as c: - c.argument('virtual_machine_scale_set_name', options_list=['--vmss-name'], completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachineScaleSets'), id_part='name') - - HyperVGenerationTypes = HyperVGenerationTypes or self.get_models('HyperVGeneration', operation_group='disks') - if HyperVGenerationTypes: - hyper_v_gen_sku = CLIArgumentType(arg_type=get_enum_type(HyperVGenerationTypes, default="V1")) - else: - hyper_v_gen_sku = CLIArgumentType(arg_type=get_enum_type(["V1", "V2"], default="V1")) - disk_snapshot_hyper_v_gen_sku = get_enum_type(HyperVGenerationTypes) if HyperVGenerationTypes else get_enum_type(["V1", "V2"]) - - ultra_ssd_enabled_type = CLIArgumentType( - arg_type=get_three_state_flag(), min_api='2018-06-01', - help='Enables or disables the capability to have 1 or more managed data disks with UltraSSD_LRS storage account') - - scale_in_policy_type = CLIArgumentType( - nargs='+', arg_type=get_enum_type(self.get_models('VirtualMachineScaleSetScaleInRules')), - help='Specify the scale-in policy (space delimited) that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in.' - ) - - edge_zone_type = CLIArgumentType( - help='The name of edge zone.', - min_api='2020-12-01' - ) - - t_shared_to = self.get_models('SharedToValues', operation_group='shared_galleries') - shared_to_type = CLIArgumentType( - arg_type=get_enum_type(t_shared_to), - help='The query parameter to decide what shared galleries to fetch when doing listing operations. ' - 'If not specified, list by subscription id.' - ) - - marker_type = CLIArgumentType( - help='A string value that identifies the portion of the list of containers to be ' - 'returned with the next listing operation. The operation returns the NextMarker value within ' - 'the response body if the listing operation did not return all containers remaining to be listed ' - 'with the current page. If specified, this generator will begin returning results from the point ' - 'where the previous generator stopped.') - - enable_vtpm_type = CLIArgumentType(arg_type=get_three_state_flag(), min_api='2020-12-01', help='Enable vTPM.') - enable_secure_boot_type = CLIArgumentType(arg_type=get_three_state_flag(), min_api='2020-12-01', help='Enable secure boot.') - # The `Standard` is used for backward compatibility to allow customers to keep their current behavior after changing the default values to Trusted Launch VMs in the future. - t_security = [x.value for x in self.get_models('SecurityTypes') or []] + [COMPATIBLE_SECURITY_TYPE_VALUE] - security_type = CLIArgumentType(arg_type=get_enum_type(t_security), min_api='2020-12-01', help='Specify the security type of the virtual machine.') - enable_auto_os_upgrade_type = CLIArgumentType(arg_type=get_three_state_flag(), min_api='2018-10-01', - help='Indicate whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the OS image becomes available.') - gallery_image_name_type = CLIArgumentType(options_list=['--gallery-image-definition', '-i'], help='The name of the community gallery image definition from which the image versions are to be listed.', id_part='child_name_2') - gallery_image_name_version_type = CLIArgumentType(options_list=['--gallery-image-version', '-e'], help='The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: ..', id_part='child_name_3') - public_gallery_name_type = CLIArgumentType(help='The public name of community gallery.', id_part='child_name_1') - disk_controller_type = CLIArgumentType(help='Specify the disk controller type configured for the VM or VMSS.', arg_type=get_enum_type(DiskControllerTypes), arg_group='Storage', is_preview=True) - - # region MixedScopes - for scope in ['vm', 'disk', 'snapshot', 'image', 'sig']: - with self.argument_context(scope) as c: - c.argument('tags', tags_type) - - for scope in ['disk', 'snapshot']: - with self.argument_context(scope) as c: - c.ignore('source_blob_uri', 'source_disk', 'source_snapshot', 'source_restore_point') - c.argument('source_storage_account_id', help='used when source blob is in a different subscription') - c.argument('size_gb', options_list=['--size-gb', '-z'], help='size in GB. Max size: 4095 GB (certain preview disks can be larger).', type=int) - c.argument('duration_in_seconds', help='Time duration in seconds until the SAS access expires', type=int) - if self.supported_api_version(min_api='2018-09-30', operation_group='disks'): - c.argument('access_level', arg_type=get_enum_type(['Read', 'Write']), default='Read', help='access level') - c.argument('hyper_v_generation', arg_type=disk_snapshot_hyper_v_gen_sku, help='The hypervisor generation of the Virtual Machine. Applicable to OS disks only.') - else: - c.ignore('access_level', 'for_upload', 'hyper_v_generation') - c.argument('encryption_type', min_api='2019-07-01', arg_type=get_enum_type(self.get_models('EncryptionType', operation_group='disks')), - help='Encryption type. EncryptionAtRestWithPlatformKey: Disk is encrypted with XStore managed key at rest. It is the default encryption type. EncryptionAtRestWithCustomerKey: Disk is encrypted with Customer managed key at rest.') - c.argument('disk_encryption_set', min_api='2019-07-01', help='Name or ID of disk encryption set that is used to encrypt the disk.') - c.argument('location', help='Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=`. If location is not specified and no default location specified, location will be automatically set as same as the resource group.') - operation_group = 'disks' if scope == 'disk' else 'snapshots' - c.argument('network_access_policy', min_api='2020-05-01', help='Policy for accessing the disk via network.', arg_type=get_enum_type(self.get_models('NetworkAccessPolicy', operation_group=operation_group))) - c.argument('disk_access', min_api='2020-05-01', help='Name or ID of the disk access resource for using private endpoints on disks.') - c.argument('enable_bursting', arg_type=get_three_state_flag(), help='Enable on-demand bursting beyond the provisioned performance target of the disk. On-demand bursting is disabled by default, and it does not apply to Ultra disks.') - c.argument('public_network_access', arg_type=get_enum_type(['Disabled', 'Enabled']), min_api='2021-04-01', is_preview=True, help='Customers can set on Managed Disks or Snapshots to control the export policy on the disk.') - c.argument('accelerated_network', arg_type=get_three_state_flag(), min_api='2021-04-01', is_preview=True, help='Customers can set on Managed Disks or Snapshots to enable the accelerated networking if the OS disk image support.') - - for scope in ['disk create', 'snapshot create']: - with self.argument_context(scope) as c: - c.argument('source', help='source to create the disk/snapshot from, including unmanaged blob uri, managed disk id or name, or snapshot id or name') - c.argument('secure_vm_disk_encryption_set', min_api='2021-08-01', help='Name or ID of disk encryption set created with ConfidentialVmEncryptedWithCustomerKey encryption type.') - # endregion - - # region Disks - with self.argument_context('disk', resource_type=ResourceType.MGMT_COMPUTE, operation_group='disks') as c: - # The `Standard` is used for backward compatibility to allow customers to keep their current behavior after changing the default values to Trusted Launch VMs in the future. - t_disk_security = [x.value for x in self.get_models('DiskSecurityTypes', operation_group='disks') or []] + [COMPATIBLE_SECURITY_TYPE_VALUE] - - c.argument('zone', zone_type, min_api='2017-03-30', options_list=['--zone']) # TODO: --size-gb currently has claimed -z. We can do a breaking change later if we want to. - c.argument('disk_name', existing_disk_name, completer=get_resource_name_completion_list('Microsoft.Compute/disks')) - c.argument('name', arg_type=name_arg_type) - c.argument('sku', arg_type=disk_sku, help='Underlying storage SKU') - c.argument('os_type', arg_type=get_enum_type(OperatingSystemTypes), help='The Operating System type of the Disk.') - c.argument('disk_iops_read_write', type=int, min_api='2018-06-01', help='The number of IOPS allowed for this disk. Only settable for UltraSSD disks. One operation can transfer between 4k and 256k bytes') - c.argument('disk_mbps_read_write', type=int, min_api='2018-06-01', help="The bandwidth allowed for this disk. Only settable for UltraSSD disks. MBps means millions of bytes per second with ISO notation of powers of 10") - c.argument('upload_size_bytes', type=int, min_api='2019-03-01', - help='The size (in bytes) of the contents of the upload including the VHD footer. Min value: 20972032. Max value: 35183298347520. This parameter is required if --upload-type is specified') - c.argument('max_shares', type=int, help='The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk that can be mounted on multiple VMs at the same time') - c.argument('disk_iops_read_only', type=int, help='The total number of IOPS that will be allowed across all VMs mounting the shared disk as ReadOnly. One operation can transfer between 4k and 256k bytes') - c.argument('disk_mbps_read_only', type=int, help='The total throughput (MBps) that will be allowed across all VMs mounting the shared disk as ReadOnly. MBps means millions of bytes per second - MB here uses the ISO notation, of powers of 10') - c.argument('image_reference', help='ID or URN (publisher:offer:sku:version) of the image from which to create a disk') - c.argument('image_reference_lun', type=int, help='If the disk is created from an image\'s data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null') - c.argument('gallery_image_reference', help='ID of the Compute, Shared or Community Gallery image version from which to create a disk. For details about valid format, please refer to the help sample') - c.ignore('gallery_image_reference_type') - c.argument('gallery_image_reference_lun', type=int, help='If the disk is created from an image\'s data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null') - c.argument('logical_sector_size', type=int, help='Logical sector size in bytes for Ultra disks. Supported values are 512 ad 4096. 4096 is the default.') - c.argument('tier', help='Performance tier of the disk (e.g, P4, S10) as described here: https://azure.microsoft.com/pricing/details/managed-disks/. Does not apply to Ultra disks.') - c.argument('edge_zone', edge_zone_type) - c.argument('security_type', arg_type=get_enum_type(t_disk_security), help='The security type of the VM. Applicable for OS disks only.', min_api='2020-12-01') - c.argument('support_hibernation', arg_type=get_three_state_flag(), help='Indicate the OS on a disk supports hibernation.', min_api='2020-12-01') - c.argument('architecture', arg_type=get_enum_type(self.get_models('Architecture', operation_group='disks')), min_api='2021-12-01', help='CPU architecture.') - c.argument('data_access_auth_mode', arg_type=get_enum_type(['AzureActiveDirectory', 'None']), min_api='2021-12-01', help='Specify the auth mode when exporting or uploading to a disk or snapshot.') - c.argument('optimized_for_frequent_attach', arg_type=get_three_state_flag(), min_api='2023-04-02', - help='Setting this property to true improves reliability and performance of data disks that are frequently (more than 5 times a day) by detached from one virtual machine and attached to another. ' - 'This property should not be set for disks that are not detached and attached frequently as it causes the disks to not align with the fault domain of the virtual machine.') - # endregion - - # region Disks - with self.argument_context('disk create', resource_type=ResourceType.MGMT_COMPUTE, operation_group='disks') as c: - c.argument('security_data_uri', min_api='2022-03-02', help='Please specify the blob URI of VHD to be imported into VM guest state') - c.argument('for_upload', arg_type=get_three_state_flag(), min_api='2018-09-30', - deprecate_info=c.deprecate(target='--for-upload', redirect='--upload-type Upload', hide=True), - help='Create the disk for uploading blobs. Replaced by "--upload-type Upload"') - c.argument('upload_type', arg_type=get_enum_type(['Upload', 'UploadWithSecurityData']), min_api='2018-09-30', - help="Create the disk for upload scenario. 'Upload' is for Standard disk only upload. 'UploadWithSecurityData' is for OS Disk upload along with VM Guest State. Please note the 'UploadWithSecurityData' is not valid for data disk upload, it only to be used for OS Disk upload at present.") - c.argument('performance_plus', arg_type=get_three_state_flag(), min_api='2022-07-02', help='Set this flag to true to get a boost on the performance target of the disk deployed. This flag can only be set on disk creation time and cannot be disabled after enabled') - # endregion - - # region Snapshots - with self.argument_context('snapshot', resource_type=ResourceType.MGMT_COMPUTE, operation_group='snapshots') as c: - c.argument('snapshot_name', existing_snapshot_name, id_part='name', completer=get_resource_name_completion_list('Microsoft.Compute/snapshots')) - c.argument('name', arg_type=name_arg_type) - c.argument('sku', arg_type=snapshot_sku) - c.argument('incremental', arg_type=get_three_state_flag(), min_api='2019-03-01', - help='Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed') - c.argument('edge_zone', edge_zone_type) - c.argument('copy_start', arg_type=get_three_state_flag(), min_api='2021-04-01', - help='Create snapshot by using a deep copy process, where the resource creation is considered complete only after all data has been copied from the source.') - c.argument('architecture', arg_type=get_enum_type(self.get_models('Architecture', operation_group='snapshots')), min_api='2021-12-01', help='CPU architecture.') - c.argument('for_upload', arg_type=get_three_state_flag(), min_api='2018-09-30', - help='Create the snapshot for uploading blobs later on through storage commands. Run "az snapshot grant-access --access-level Write" to retrieve the snapshot\'s SAS token.') - c.argument('elastic_san_resource_id', min_api='2023-04-02', - options_list=['--elastic-san-resource-id', '--elastic-san-id'], - help='This is the ARM id of the source elastic san volume snapshot.') - c.argument('bandwidth_copy_speed', min_api='2023-10-02', - help='If this field is set on a snapshot and createOption is CopyStart, the snapshot will be copied at a quicker speed.', - arg_type=get_enum_type(["None", "Enhanced"])) - - with self.argument_context('snapshot grant-access', resource_type=ResourceType.MGMT_COMPUTE, operation_group='snapshots') as c: - c.argument('file_format', arg_type=get_enum_type(self.get_models('FileFormat', operation_group='snapshots')), help='Used to specify the file format when making request for SAS on a VHDX file format snapshot.') - # endregion - - # region Images - with self.argument_context('image') as c: - c.argument('os_type', arg_type=get_enum_type(['Windows', 'Linux'])) - c.argument('image_name', arg_type=name_arg_type, id_part='name', completer=get_resource_name_completion_list('Microsoft.Compute/images')) - c.argument('tags', tags_type) - - with self.argument_context('image create') as c: - # here we collpase all difference image sources to under 2 common arguments --os-disk-source --data-disk-sources - c.argument('name', arg_type=name_arg_type, help='new image name') - c.argument('source', help='OS disk source from the same region, including a virtual machine ID or name, OS disk blob URI, managed OS disk ID or name, or OS snapshot ID or name') - c.argument('data_disk_sources', nargs='+', help='Space-separated list of data disk sources, including unmanaged blob URI, managed disk ID or name, or snapshot ID or name') - c.argument('zone_resilient', min_api='2017-12-01', arg_type=get_three_state_flag(), help='Specifies whether an image is zone resilient or not. ' - 'Default is false. Zone resilient images can be created only in regions that provide Zone Redundant Storage') - c.argument('storage_sku', arg_type=disk_sku, help='The SKU of the storage account with which to create the VM image. Unused if source VM is specified.') - c.argument('os_disk_caching', arg_type=get_enum_type(CachingTypes), help="Storage caching type for the image's OS disk.") - c.argument('data_disk_caching', arg_type=get_enum_type(CachingTypes), - help="Storage caching type for the image's data disk.") - c.argument('hyper_v_generation', arg_type=hyper_v_gen_sku, min_api="2019-03-01", help='The hypervisor generation of the Virtual Machine created from the image.') - c.ignore('source_virtual_machine', 'os_blob_uri', 'os_disk', 'os_snapshot', 'data_blob_uris', 'data_disks', 'data_snapshots') - c.argument('edge_zone', edge_zone_type, ) - # endregion - - # region Image Templates - with self.argument_context('image builder') as c: - ib_output_name_help = "Name of the image builder run output." - - c.argument('location', get_location_type(self.cli_ctx)) - c.argument('scripts', nargs='+', help="Space-separated list of shell or powershell scripts to customize the image with. Each script must be a publicly accessible URL." - " Infers type of script from file extension ('.sh' or'.ps1') or from source type. More more customizer options and flexibility, see: 'az image template customizer add'") - c.argument('source', options_list=["--image-source", "-i"], help="The base image to customize. Must be a valid platform image URN, platform image alias, Red Hat ISO image URI, managed image name/ID, or shared image version ID.") - c.argument('image_template_name', image_template_name_type, help="The name of the image template.") - c.argument('checksum', help="The SHA256 checksum of the Red Hat ISO image") - c.argument('managed_image_destinations', nargs='+', help='Managed image output distributor information. Space-separated list of key-value pairs. E.g "image_1=westus2 image_2=westus". Each key is the name or resource ID of the managed image to be created. Each value is the location of the image.') - c.argument('shared_image_destinations', nargs='+', help='Shared image gallery (sig) output distributor information. Space-separated list of key-value pairs. E.g "my_gallery_1/image_def_1=eastus,westus my_gallery_2/image_def_2=uksouth,canadaeast,francesouth." ' - 'Each key is the sig image definition ID or sig gallery name and sig image definition delimited by a "/". Each value is a comma-delimited list of replica locations.') - c.argument('output_name', help=ib_output_name_help) - c.ignore('destinations_lists', 'scripts_list', 'source_dict') - - with self.argument_context('image builder create') as c: - ib_source_type = CLIArgumentType(arg_group="Image Source") - ib_customizer_type = CLIArgumentType(arg_group="Customizer") - ib_cutput_type = CLIArgumentType(arg_group="Output") - - c.argument('build_timeout', type=int, help="The Maximum duration to wait while building the image template, in minutes. Default is 60.") - c.argument('image_template', help='Local path or URL to an image template file. When using --image-template, all other parameters are ignored except -g and -n. Reference: https://learn.microsoft.com/azure/virtual-machines/linux/image-builder-json') - c.argument('identity', nargs='+', help='List of user assigned identities (name or ID, space delimited) of the image template.') - c.argument('staging_resource_group', min_api='2022-02-14', help='The staging resource group id in the same subscription as the image template that will be used to build the image.') - - # VM profile - c.argument('vm_size', help='Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2)') - c.argument('os_disk_size', type=int, help='Size of the OS disk in GB. Omit or specify 0 to use Azure\'s default OS disk size') - c.argument('vnet', help='Name of VNET to deploy the build virtual machine. You should only specify it when subnet is a name') - c.argument('subnet', help='Name or ID of subnet to deploy the build virtual machine') - c.argument('proxy_vm_size', help='Size of the virtual machine used to build, customize and capture images (Standard_D1_v2 for Gen1 images and Standard_D2ds_v4 for Gen2 images).') - c.argument('build_vm_identities', nargs='+', help='Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual network needs to be used.') - c.argument('validator', nargs='+', min_api='2022-07-01', - help='The type of validation you want to use on the Image. For example, "Shell" can be shell validation.') - - # Image Source Arguments - c.argument('source', arg_type=ib_source_type) - c.argument('checksum', arg_type=ib_source_type) - c.argument('', arg_type=ib_source_type) - - # Image Customizer Arguments - c.argument('scripts', arg_type=ib_customizer_type) - c.argument('', arg_type=ib_customizer_type) - c.argument('', arg_type=ib_customizer_type) - - # Image Output Arguments - c.argument('managed_image_destinations', arg_type=ib_cutput_type) - c.argument('shared_image_destinations', arg_type=ib_cutput_type) - c.argument('output_name', arg_type=ib_cutput_type) - - for scope in ['image builder identity assign', 'image builder identity remove']: - with self.argument_context(scope, min_api='2022-02-14') as c: - c.argument('user_assigned', arg_group='Managed Identity', nargs='*', help='Specify one user assigned identity (name or ID, space delimited) of the image template.') - - with self.argument_context('image builder output') as c: - ib_sig_regions_help = "Space-separated list of regions to replicate the image version into." - ib_img_location_help = "Location where the customized image will be created." - - c.argument('gallery_image_definition', arg_group="Shared Image Gallery", help="Name or ID of the existing SIG image definition to create the customized image version with.") - c.argument('gallery_name', arg_group="Shared Image Gallery", help="Shared image gallery name, if image definition name and not ID was provided.") - c.argument('gallery_replication_regions', arg_group="Shared Image Gallery", nargs='+', help=ib_sig_regions_help) - c.argument('managed_image', arg_group="Managed Image", help="Name or ID of the customized managed image to be created.") - c.argument('managed_image_location', arg_group="Managed Image", help=ib_img_location_help) - - with self.argument_context('image builder output add') as c: - ib_artifact_tags_help = "Tags that will be applied to the output artifact once it has been created by the distributor. " + tags_type.settings['help'] - ib_artifact_tags_type = CLIArgumentType(overrides=tags_type, help=ib_artifact_tags_help, options_list=["--artifact-tags"]) - ib_default_loc_help = " Defaults to resource group's location." - - c.argument('output_name', help=ib_output_name_help + " Defaults to the name of the managed image or sig image definition.") - c.argument('gallery_replication_regions', arg_group="Shared Image Gallery", nargs='+', help=ib_sig_regions_help + ib_default_loc_help) - c.argument('managed_image_location', arg_group="Managed Image", help=ib_img_location_help + ib_default_loc_help) - c.argument('is_vhd', arg_group="VHD", help="The output is a VHD distributor.", action='store_true') - c.argument('vhd_uri', arg_group="VHD", help="Optional Azure Storage URI for the distributed VHD blob. Omit to use the default (empty string) in which case VHD would be published to the storage account in the staging resource group.") - c.argument('versioning', get_enum_type(['Latest', 'Source']), help="Describe how to generate new x.y.z version number for distribution.") - c.argument('tags', arg_type=ib_artifact_tags_type) - c.ignore('location') - - with self.argument_context('image builder output versioning set') as c: - c.argument('scheme', get_enum_type(['Latest', 'Source']), help='Version numbering scheme to be used.') - c.argument('major', type=int, help='Major version for the generated version number. Determine what is "latest" based on versions with this value as the major version. -1 is equivalent to leaving it unset.') - - with self.argument_context('image builder customizer') as c: - ib_win_restart_type = CLIArgumentType(arg_group="Windows Restart") - ib_win_update_type = CLIArgumentType(arg_group="Windows Update") - ib_script_type = CLIArgumentType(arg_group="Shell and Powershell") - ib_powershell_type = CLIArgumentType(arg_group="Powershell") - ib_file_customizer_type = CLIArgumentType(arg_group="File") - - c.argument('customizer_name', help="Name of the customizer.") - c.argument('customizer_type', options_list=['--type', '-t'], help="Type of customizer to be added to the image template.", arg_type=get_enum_type(ScriptType)) - - # Script Args - c.argument('script_url', arg_type=ib_script_type, help="URL of script to customize the image with. The URL must be publicly accessible.") - c.argument('inline_script', arg_type=ib_script_type, nargs='+', help="Space-separated list of inline script lines to customize the image with.") - - # Powershell Specific Args - c.argument('valid_exit_codes', options_list=['--exit-codes', '-e'], arg_type=ib_powershell_type, nargs='+', help="Space-separated list of valid exit codes, as integers") - - # Windows Restart Specific Args - c.argument('restart_command', arg_type=ib_win_restart_type, help="Command to execute the restart operation.") - c.argument('restart_check_command', arg_type=ib_win_restart_type, help="Command to verify that restart succeeded.") - c.argument('restart_timeout', arg_type=ib_win_restart_type, help="Restart timeout specified as a string consisting of a magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours)", default="5m") - - # Windows Update Specific Args - c.argument('search_criteria', arg_type=ib_win_update_type, help='Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field.') - c.argument('filters', arg_type=ib_win_update_type, nargs='+', help='Space delimited filters to select updates to apply. Omit or specify empty array to use the default (no filter)') - c.argument('update_limit', arg_type=ib_win_update_type, help='Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000)') - - # File Args - c.argument('file_source', arg_type=ib_file_customizer_type, help="The URI of the file to be downloaded into the image. It can be a github link, SAS URI for Azure Storage, etc.") - c.argument('dest_path', arg_type=ib_file_customizer_type, help="The absolute destination path where the file specified in --file-source will be downloaded to in the image") - - with self.argument_context('image builder validator add', min_api='2022-02-14') as c: - c.argument('dis_on_failure', options_list=['--continue-distribute-on-failure', '--dis-on-failure'], arg_type=get_three_state_flag(), help="If validation fails and this parameter is set to false, output image(s) will not be distributed.") - c.argument('source_validation_only', arg_type=get_three_state_flag(), help="If this parameter is set to true, the image specified in the 'source' section will directly be validated. No separate build will be run to generate and then validate a customized image.") - - for scope in ['image builder optimizer add', 'image builder optimizer update']: - with self.argument_context(scope, min_api='2022-07-01') as c: - c.argument('enable_vm_boot', arg_type=get_three_state_flag(), help='If this parameter is set to true, VM boot time will be improved by optimizing the final customized image output.') - - with self.argument_context('image builder error-handler add', min_api='2023-07-01') as c: - from azure.mgmt.imagebuilder.models import OnBuildError - c.argument('on_customizer_error', arg_type=get_enum_type(OnBuildError), - help='If there is a customizer error and this field is set to "cleanup", the build VM and associated network resources will be cleaned up. This is the default behavior. ' - 'If there is a customizer error and this field is set to "abort", the build VM will be preserved.') - c.argument('on_validation_error', arg_type=get_enum_type(OnBuildError), - help='If there is a validation error and this field is set to "cleanup", the build VM and associated network resources will be cleaned up. This is the default behavior. ' - 'If there is a validation error and this field is set to "abort", the build VM will be preserved.') - # endregion - - # region AvailabilitySets - with self.argument_context('vm availability-set') as c: - c.argument('availability_set_name', name_arg_type, id_part='name', completer=get_resource_name_completion_list('Microsoft.Compute/availabilitySets'), help='Name of the availability set') - - with self.argument_context('vm availability-set create') as c: - c.argument('availability_set_name', name_arg_type, validator=get_default_location_from_resource_group, help='Name of the availability set') - c.argument('platform_update_domain_count', type=int, help='Update Domain count. If unspecified, the server will pick the most optimal number like 5.') - c.argument('platform_fault_domain_count', type=int, help='Fault Domain count.') - c.argument('validate', help='Generate and validate the ARM template without creating any resources.', action='store_true') - c.argument('unmanaged', action='store_true', min_api='2016-04-30-preview', help='contained VMs should use unmanaged disks') - # endregion - - # region VirtualMachines - with self.argument_context('vm') as c: - c.argument('vm_name', existing_vm_name) - c.argument('size', completer=get_vm_size_completion_list) - c.argument('name', arg_type=name_arg_type) - c.argument('zone', zone_type, min_api='2017-03-30') - c.argument('caching', help='Disk caching policy', arg_type=get_enum_type(CachingTypes)) - c.argument('nsg', help='The name to use when creating a new Network Security Group (default) or referencing an existing one. Can also reference an existing NSG by ID or specify "" for none.', arg_group='Network') - c.argument('nsg_rule', help='NSG rule to create when creating a new NSG. Defaults to open ports for allowing RDP on Windows and allowing SSH on Linux.', arg_group='Network', arg_type=get_enum_type(['RDP', 'SSH'])) - c.argument('application_security_groups', min_api='2017-09-01', nargs='+', options_list=['--asgs'], help='Space-separated list of existing application security groups to associate with the VM.', arg_group='Network') - c.argument('workspace', is_preview=True, arg_group='Monitor', help='Name or ID of Log Analytics Workspace. If you specify the workspace through its name, the workspace should be in the same resource group with the vm, otherwise a new workspace will be created.') - with self.argument_context('vm capture') as c: - c.argument('overwrite', action='store_true') - - with self.argument_context('vm update') as c: - c.argument('os_disk', min_api='2017-12-01', help="Managed OS disk ID or name to swap to") - c.argument('write_accelerator', nargs='*', min_api='2017-12-01', - help="enable/disable disk write accelerator. Use singular value 'true/false' to apply across, or specify individual disks, e.g.'os=true 1=true 2=true' for os disk and data disks with lun of 1 & 2") - c.argument('disk_caching', nargs='*', help="Use singular value to apply across, or specify individual disks, e.g. 'os=ReadWrite 0=None 1=ReadOnly' should enable update os disk and 2 data disks") - c.argument('ultra_ssd_enabled', ultra_ssd_enabled_type) - c.argument('enable_secure_boot', enable_secure_boot_type) - c.argument('enable_vtpm', enable_vtpm_type) - c.argument('size', help='The new size of the virtual machine. See https://azure.microsoft.com/pricing/details/virtual-machines/ for size info.', is_preview=True) - c.argument('ephemeral_os_disk_placement', arg_type=ephemeral_placement_type, - help='Only applicable when used with `--size`. Allows you to choose the Ephemeral OS disk provisioning location.') - c.argument('enable_hibernation', arg_type=get_three_state_flag(), min_api='2021-03-01', help='The flag that enable or disable hibernation capability on the VM.') - c.argument('security_type', arg_type=get_enum_type(["TrustedLaunch"], default=None), min_api='2022-11-01', help='Specify the security type of the virtual machine.') - - with self.argument_context('vm create') as c: - c.argument('name', name_arg_type, validator=_resource_not_exists(self.cli_ctx, 'Microsoft.Compute/virtualMachines')) - c.argument('vm_name', name_arg_type, id_part=None, help='Name of the virtual machine.', completer=None) - c.argument('os_disk_size_gb', type=int, help='the size of the os disk in GB', arg_group='Storage') - c.argument('availability_set', help='Name or ID of an existing availability set to add the VM to. None by default.') - c.argument('vmss', help='Name or ID of an existing virtual machine scale set that the virtual machine should be assigned to. None by default.') - c.argument('nsg', help='The name to use when creating a new Network Security Group (default) or referencing an existing one. Can also reference an existing NSG by ID or specify "" for none (\'""\' in Azure CLI using PowerShell or --% operator).', arg_group='Network') - c.argument('nsg_rule', help='NSG rule to create when creating a new NSG. Defaults to open ports for allowing RDP on Windows and allowing SSH on Linux. NONE represents no NSG rule', arg_group='Network', arg_type=get_enum_type(['RDP', 'SSH', 'NONE'])) - c.argument('application_security_groups', resource_type=ResourceType.MGMT_NETWORK, min_api='2017-09-01', nargs='+', options_list=['--asgs'], help='Space-separated list of existing application security groups to associate with the VM.', arg_group='Network', validator=validate_asg_names_or_ids) - c.argument('boot_diagnostics_storage', - help='pre-existing storage account name or its blob uri to capture boot diagnostics. Its sku should be one of Standard_GRS, Standard_LRS and Standard_RAGRS') - c.argument('accelerated_networking', resource_type=ResourceType.MGMT_NETWORK, min_api='2016-09-01', arg_type=get_three_state_flag(), arg_group='Network', - help="enable accelerated networking. Unless specified, CLI will enable it based on machine image and size") - if self.supported_api_version(min_api='2019-03-01', resource_type=ResourceType.MGMT_COMPUTE): - VirtualMachineEvictionPolicyTypes = self.get_models('VirtualMachineEvictionPolicyTypes', resource_type=ResourceType.MGMT_COMPUTE) - c.argument('eviction_policy', resource_type=ResourceType.MGMT_COMPUTE, min_api='2019-03-01', - arg_type=get_enum_type(VirtualMachineEvictionPolicyTypes, default=None), - help="The eviction policy for the Spot priority virtual machine. Default eviction policy is Deallocate for a Spot priority virtual machine") - c.argument('enable_agent', arg_type=get_three_state_flag(), min_api='2018-06-01', - help='Indicates whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later') - c.argument('enable_auto_update', arg_type=get_three_state_flag(), min_api='2020-06-01', - help='Indicate whether Automatic Updates is enabled for the Windows virtual machine') - c.argument('patch_mode', arg_type=get_enum_type(['AutomaticByOS', 'AutomaticByPlatform', 'Manual', 'ImageDefault']), min_api='2020-12-01', - help='Mode of in-guest patching to IaaS virtual machine. Allowed values for Windows VM: AutomaticByOS, AutomaticByPlatform, Manual. Allowed values for Linux VM: AutomaticByPlatform, ImageDefault. Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the paramater --enable-auto-update must be false. AutomaticByOS - The virtual machine will automatically be updated by the OS. The parameter --enable-auto-update must be true. AutomaticByPlatform - the virtual machine will automatically updated by the OS. ImageDefault - The virtual machine\'s default patching configuration is used. The parameter --enable-agent and --enable-auto-update must be true') - c.argument('ssh_key_name', help='Use it as public key in virtual machine. It should be an existing SSH key resource in Azure.') - c.argument('enable_hotpatching', arg_type=get_three_state_flag(), help='Patch VMs without requiring a reboot. --enable-agent must be set and --patch-mode must be set to AutomaticByPlatform', min_api='2020-12-01') - c.argument('platform_fault_domain', min_api='2020-06-01', - help='Specify the scale set logical fault domain into which the virtual machine will be created. By default, the virtual machine will be automatically assigned to a fault domain that best maintains balance across available fault domains. This is applicable only if the virtualMachineScaleSet property of this virtual machine is set. The virtual machine scale set that is referenced, must have platform fault domain count. This property cannot be updated once the virtual machine is created. Fault domain assignment can be viewed in the virtual machine instance view') - c.argument('count', type=int, is_preview=True, - help='Number of virtual machines to create. Value range is [2, 250], inclusive. Don\'t specify this parameter if you want to create a normal single VM. The VMs are created in parallel. The output of this command is an array of VMs instead of one single VM. Each VM has its own public IP, NIC. VNET and NSG are shared. It is recommended that no existing public IP, NIC, VNET and NSG are in resource group. When --count is specified, --attach-data-disks, --attach-os-disk, --boot-diagnostics-storage, --computer-name, --host, --host-group, --nics, --os-disk-name, --private-ip-address, --public-ip-address, --public-ip-address-dns-name, --storage-account, --storage-container-name, --subnet, --use-unmanaged-disk, --vnet-name are not allowed.') - c.argument('security_type', security_type) - c.argument('enable_secure_boot', enable_secure_boot_type) - c.argument('enable_vtpm', enable_vtpm_type) - c.argument('user_data', help='UserData for the VM. It can be passed in as file or string.', completer=FilesCompleter(), type=file_type, min_api='2021-03-01') - c.argument('enable_hibernation', arg_type=get_three_state_flag(), min_api='2021-03-01', help='The flag that enable or disable hibernation capability on the VM.') - - with self.argument_context('vm create', arg_group='Storage') as c: - c.argument('attach_os_disk', help='Attach an existing OS disk to the VM. Can use the name or ID of a managed disk or the URI to an unmanaged disk VHD.') - c.argument('attach_data_disks', nargs='+', help='Attach existing data disks to the VM. Can use the name or ID of a managed disk or the URI to an unmanaged disk VHD.') - c.argument('os_disk_delete_option', arg_type=get_enum_type(self.get_models('DiskDeleteOptionTypes')), min_api='2021-03-01', help='Specify the behavior of the managed disk when the VM gets deleted i.e whether the managed disk is deleted or detached.') - c.argument('data_disk_delete_option', options_list=['--data-disk-delete-option', self.deprecate(target='--data-delete-option', redirect='--data-disk-delete-option', hide=True)], nargs='+', min_api='2021-03-01', help='Specify whether data disk should be deleted or detached upon VM deletion. If a single data disk is attached, the allowed values are Delete and Detach. For multiple data disks are attached, please use "=Delete =Detach" to configure each disk') - c.argument('source_snapshots_or_disks', options_list=['--source-snapshots-or-disks', '--source-resource'], nargs='+', min_api='2024-03-01', help='Create a data disk from a snapshot or another disk. Can use the ID of a disk or snapshot.') - c.argument('source_snapshots_or_disks_size_gb', options_list=['--source-snapshots-or-disks-size-gb', '--source-resource-size'], nargs='+', type=int, min_api='2024-03-01', help='The size of the source disk in GB') - c.argument('source_disk_restore_point', options_list=['--source-disk-restore-point', '--source-disk-rp'], nargs='+', min_api='2024-03-01', help='create a data disk from a disk restore point. Can use the ID of a disk restore point.') - c.argument('source_disk_restore_point_size_gb', options_list=['--source-disk-restore-point-size-gb', '--source-rp-size'], nargs='+', type=int, min_api='2024-03-01', help='The size of the source disk restore point in GB') - - with self.argument_context('vm create', arg_group='Dedicated Host', min_api='2019-03-01') as c: - c.argument('dedicated_host_group', options_list=['--host-group'], is_preview=True, help="Name or resource ID of the dedicated host group that the VM will reside in. --host and --host-group can't be used together.") - c.argument('dedicated_host', options_list=['--host'], is_preview=True, help="Resource ID of the dedicated host that the VM will reside in. --host and --host-group can't be used together.") - - with self.argument_context('vm update', arg_group='Dedicated Host', min_api='2019-03-01') as c: - c.argument('dedicated_host_group', options_list=['--host-group'], is_preview=True, help="Name or resource ID of the dedicated host group that the VM will reside in. --host and --host-group can't be used together. You should deallocate the VM before update, and start the VM after update. Please check out help for more examples.") - c.argument('dedicated_host', options_list=['--host'], is_preview=True, help="Resource ID of the dedicated host that the VM will reside in. --host and --host-group can't be used together. You should deallocate the VM before update, and start the VM after update. Please check out help for more examples.") - - with self.argument_context('vm open-port') as c: - c.argument('vm_name', name_arg_type, help='The name of the virtual machine to open inbound traffic on.') - c.argument('network_security_group_name', options_list=('--nsg-name',), help='The name of the network security group to create if one does not exist. Ignored if an NSG already exists.', validator=validate_nsg_name) - c.argument('apply_to_subnet', help='Allow inbound traffic on the subnet instead of the NIC', action='store_true') - c.argument('port', help="The port or port range (ex: 80-100) to open inbound traffic to. Use '*' to allow traffic to all ports. Use comma separated values to specify more than one port or port range.") - c.argument('priority', help='Rule priority, between 100 (highest priority) and 4096 (lowest priority). Must be unique for each rule in the collection.', type=int) - - with self.argument_context('vm list') as c: - c.argument('vmss', min_api='2021-11-01', help='List VM instances in a specific VMSS. Please specify the VMSS id or VMSS name') - - for scope in ['vm show', 'vm list']: - with self.argument_context(scope) as c: - c.argument('show_details', action='store_true', options_list=['--show-details', '-d'], help='show public ip address, FQDN, and power states. command will run slow') - - for scope in ['vm show', 'vmss show']: - with self.argument_context(scope) as c: - c.argument('include_user_data', action='store_true', options_list=['--include-user-data', '-u'], help='Include the user data properties in the query result.', min_api='2021-03-01') - - for scope in ['vm get-instance-view', 'vm wait', 'vmss wait']: - with self.argument_context(scope) as c: - c.ignore('include_user_data') - - with self.argument_context('vm diagnostics') as c: - c.argument('vm_name', arg_type=existing_vm_name, options_list=['--vm-name']) - - with self.argument_context('vm diagnostics set') as c: - c.argument('storage_account', completer=get_resource_name_completion_list('Microsoft.Storage/storageAccounts')) - - with self.argument_context('vm install-patches') as c: - c.argument('maximum_duration', type=str, help='Specify the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours)') - c.argument('reboot_setting', arg_type=get_enum_type(RebootSetting), help='Define when it is acceptable to reboot a VM during a software update operation.') - c.argument('classifications_to_include_win', nargs='+', arg_type=get_enum_type(VMGuestPatchClassificationWindows), help='Space-separated list of classifications to include for Windows VM.') - c.argument('classifications_to_include_linux', nargs='+', arg_type=get_enum_type(VMGuestPatchClassificationLinux), help='Space-separated list of classifications to include for Linux VM.') - c.argument('kb_numbers_to_include', nargs='+', help='Space-separated list of KBs to include in the patch operation. Applicable to Windows VM only') - c.argument('kb_numbers_to_exclude', nargs='+', help='Space-separated list of KBs to exclude in the patch operation. Applicable to Windows VM only') - c.argument('exclude_kbs_requiring_reboot', arg_type=get_three_state_flag(), help="Filter out KBs that don't have a reboot behavior of 'NeverReboots' when this is set. Applicable to Windows VM only") - c.argument('package_name_masks_to_include', nargs='+', help='Space-separated list of packages to include in the patch operation. Format: packageName_packageVersion. Applicable to Linux VM only') - c.argument('package_name_masks_to_exclude', nargs='+', help='Space-separated list of packages to exclude in the patch operation. Format: packageName_packageVersion. Applicable to Linux VM only') - c.argument('max_patch_publish_date', arg_type=get_datetime_type(help='ISO 8601 time value for install patch that were published on or before this given max published date.')) - - with self.argument_context('vm disk') as c: - c.argument('vm_name', options_list=['--vm-name'], id_part=None, completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachines')) - c.argument('new', action='store_true', help='create a new disk') - c.argument('sku', arg_type=disk_sku, help='Underlying storage SKU') - c.argument('size_gb', options_list=['--size-gb', '-z'], help='size in GB. Max size: 4095 GB (certain preview disks can be larger).', type=int) - c.argument('lun', type=int, help='0-based logical unit number (LUN). Max value depends on the Virtual Machine size.') - - with self.argument_context('vm disk attach') as c: - c.argument('enable_write_accelerator', min_api='2017-12-01', action='store_true', help='enable write accelerator') - c.argument('disk', options_list=['--name', '-n', c.deprecate(target='--disk', redirect='--name', hide=True)], - help="The name or ID of the managed disk", id_part='name', - completer=get_resource_name_completion_list('Microsoft.Compute/disks')) - c.argument('disks', nargs='*', help="One or more names or IDs of the managed disk (space-delimited).", - completer=get_resource_name_completion_list('Microsoft.Compute/disks')) - c.argument('ids', deprecate_info=c.deprecate(target='--ids', redirect='--disks', hide=True)) - c.argument('disk_ids', nargs='+', min_api='2024-03-01', help='The disk IDs of the managed disk (space-delimited).') - - with self.argument_context('vm disk detach') as c: - c.argument('disk_name', arg_type=name_arg_type, help='The data disk name.') - c.argument('force_detach', action='store_true', min_api='2020-12-01', help='Force detach managed data disks from a VM.') - c.argument('disk_ids', nargs='+', min_api='2024-03-01', help='The disk IDs of the managed disk (space-delimited).') - - with self.argument_context('vm encryption enable') as c: - c.argument('encrypt_format_all', action='store_true', help='Encrypts-formats data disks instead of encrypting them. Encrypt-formatting is a lot faster than in-place encryption but wipes out the partition getting encrypt-formatted. (Only supported for Linux virtual machines.)') - # Place aad arguments in their own group - aad_arguments = 'Azure Active Directory' - c.argument('aad_client_id', arg_group=aad_arguments) - c.argument('aad_client_secret', arg_group=aad_arguments) - c.argument('aad_client_cert_thumbprint', arg_group=aad_arguments) - - with self.argument_context('vm extension') as c: - c.argument('vm_extension_name', name_arg_type, completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachines/extensions'), help='Name of the extension.', id_part='child_name_1') - c.argument('vm_name', arg_type=existing_vm_name, options_list=['--vm-name'], id_part='name') - c.argument('expand', help='The expand expression to apply on the operation.', deprecate_info=c.deprecate(expiration='3.0.0', hide=True)) - - with self.argument_context('vm extension list') as c: - c.argument('vm_name', arg_type=existing_vm_name, options_list=['--vm-name']) - - with self.argument_context('vm extension show') as c: - c.argument('instance_view', action='store_true', help='The instance view of a virtual machine extension.') - - with self.argument_context('vm secret') as c: - c.argument('secrets', multi_ids_type, options_list=['--secrets', '-s'], help='Space-separated list of key vault secret URIs. Perhaps, produced by \'az keyvault secret list-versions --vault-name vaultname -n cert1 --query "[?attributes.enabled].id" -o tsv\'') - c.argument('keyvault', help='Name or ID of the key vault.', validator=validate_keyvault) - c.argument('certificate', help='key vault certificate name or its full secret URL') - c.argument('certificate_store', help='Windows certificate store names. Default: My') - - with self.argument_context('vm secret list') as c: - c.argument('vm_name', arg_type=existing_vm_name, id_part=None) - - with self.argument_context('vm image') as c: - c.argument('publisher_name', options_list=['--publisher', '-p'], help='image publisher') - c.argument('publisher', options_list=['--publisher', '-p'], help='image publisher') - c.argument('offer', options_list=['--offer', '-f'], help='image offer') - c.argument('plan', help='image billing plan') - c.argument('sku', options_list=['--sku', '-s'], help='image sku') - c.argument('version', help="image sku's version") - c.argument('urn', help="URN, in format of 'publisher:offer:sku:version' or 'publisher:offer:sku:edge_zone:version'. If specified, other argument values can be omitted") - - with self.argument_context('vm image list') as c: - c.argument('image_location', get_location_type(self.cli_ctx)) - c.argument('architecture', help='The name of architecture. ', arg_type=get_enum_type(["x64", "Arm64"])) - - with self.argument_context('vm image show') as c: - c.argument('skus', options_list=['--sku', '-s']) - - with self.argument_context('vm image terms') as c: - c.argument('urn', help='URN, in the format of \'publisher:offer:sku:version\'. If specified, other argument values can be omitted') - c.argument('publisher', help='Image publisher') - c.argument('offer', help='Image offer') - c.argument('plan', help='Image billing plan') - - with self.argument_context('vm nic') as c: - c.argument('vm_name', existing_vm_name, options_list=['--vm-name'], id_part=None) - c.argument('nics', nargs='+', help='Names or IDs of NICs.', validator=validate_vm_nics) - c.argument('primary_nic', help='Name or ID of the primary NIC. If missing, the first NIC in the list will be the primary.') - - with self.argument_context('vm nic show') as c: - c.argument('nic', help='NIC name or ID.', validator=validate_vm_nic) - - with self.argument_context('vm unmanaged-disk') as c: - c.argument('new', action='store_true', help='Create a new disk.') - c.argument('lun', type=int, help='0-based logical unit number (LUN). Max value depends on the Virtual Machine size.') - c.argument('vhd_uri', help="Virtual hard disk URI. For example: https://mystorage.blob.core.windows.net/vhds/d1.vhd") - - with self.argument_context('vm unmanaged-disk attach') as c: - c.argument('disk_name', options_list=['--name', '-n'], help='The data disk name.') - c.argument('size_gb', options_list=['--size-gb', '-z'], help='size in GB. Max size: 4095 GB (certain preview disks can be larger).', type=int) - - with self.argument_context('vm unmanaged-disk detach') as c: - c.argument('disk_name', options_list=['--name', '-n'], help='The data disk name.') - - for scope in ['vm unmanaged-disk attach', 'vm unmanaged-disk detach']: - with self.argument_context(scope) as c: - c.argument('vm_name', arg_type=existing_vm_name, options_list=['--vm-name'], id_part=None) - - with self.argument_context('vm unmanaged-disk list') as c: - c.argument('vm_name', options_list=['--vm-name', '--name', '-n'], arg_type=existing_vm_name, id_part=None) - - with self.argument_context('vm user') as c: - c.argument('username', options_list=['--username', '-u'], help='The user name') - c.argument('password', options_list=['--password', '-p'], help='The user password') - - with self.argument_context('vm list-skus') as c: - c.argument('size', options_list=['--size', '-s'], help="size name, partial name is accepted") - c.argument('zone', options_list=['--zone', '-z'], arg_type=get_three_state_flag(), help="show skus supporting availability zones") - c.argument('show_all', options_list=['--all'], arg_type=get_three_state_flag(), - help="show all information including vm sizes not available under the current subscription") - c.argument('resource_type', options_list=['--resource-type', '-r'], help='resource types e.g. "availabilitySets", "snapshots", "disks", etc') - - with self.argument_context('vm restart') as c: - c.argument('force', action='store_true', help='Force the VM to restart by redeploying it. Use if the VM is unresponsive.') - - with self.argument_context('vm host') as c: - c.argument('host_group_name', options_list=['--host-group'], id_part='name', help="Name of the Dedicated Host Group") - c.argument('host_name', name_arg_type, id_part='child_name_1', help="Name of the Dedicated Host") - c.ignore('expand') - - with self.argument_context('vm host create') as c: - c.argument('platform_fault_domain', options_list=['--platform-fault-domain', '-d'], type=int, - help="Fault domain of the host within a group. Allowed values: 0, 1, 2") - c.argument('auto_replace_on_failure', options_list=['--auto-replace'], arg_type=get_three_state_flag(), - help="Replace the host automatically if a failure occurs") - c.argument('license_type', arg_type=get_enum_type(DedicatedHostLicenseTypes), - help="The software license type that will be applied to the VMs deployed on the dedicated host.") - c.argument('sku', help="SKU of the dedicated host. Available SKUs: https://azure.microsoft.com/pricing/details/virtual-machines/dedicated-host/") - - with self.argument_context('vm host group') as c: - c.argument('host_group_name', name_arg_type, id_part='name', help="Name of the Dedicated Host Group") - c.argument('automatic_placement', arg_type=get_three_state_flag(), min_api='2020-06-01', - help='Specify whether virtual machines or virtual machine scale sets can be placed automatically ' - 'on the dedicated host group. Automatic placement means resources are allocated on dedicated ' - 'hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to ' - 'false when not provided.') - - with self.argument_context('vm host group create') as c: - c.argument('platform_fault_domain_count', options_list=["--platform-fault-domain-count", "-c"], type=int, - help="Number of fault domains that the host group can span.") - c.argument('zones', zone_type) - c.argument('ultra_ssd_enabled', arg_type=get_three_state_flag(), min_api='2022-03-01', help='Enable a capability to have UltraSSD Enabled Virtual Machines on Dedicated Hosts of the Dedicated Host Group.') - - for scope in ["vm host", "vm host group"]: - with self.argument_context("{} create".format(scope)) as c: - location_type = get_location_type(self.cli_ctx) - custom_location_msg = " Otherwise, location will default to the resource group's location" - custom_location_type = CLIArgumentType(overrides=location_type, - help=location_type.settings["help"] + custom_location_msg) - c.argument('location', arg_type=custom_location_type) - # endregion - - # region VMSS - scaleset_name_aliases = ['vm_scale_set_name', 'virtual_machine_scale_set_name', 'name'] - - with self.argument_context('vmss') as c: - c.argument('zones', zones_type, min_api='2017-03-30') - c.argument('instance_id', id_part='child_name_1') - c.argument('instance_ids', multi_ids_type, help='Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances. If not provided, the action will be applied on the scaleset itself') - c.argument('tags', tags_type) - c.argument('caching', help='Disk caching policy', arg_type=get_enum_type(CachingTypes)) - for dest in scaleset_name_aliases: - c.argument(dest, vmss_name_type) - c.argument('host_group', min_api='2020-06-01', - help='Name or ID of dedicated host group that the virtual machine scale set resides in') - - for scope in ['vmss deallocate', 'vmss delete-instances', 'vmss restart', 'vmss start', 'vmss stop', 'vmss show', 'vmss update-instances', 'vmss simulate-eviction']: - with self.argument_context(scope) as c: - for dest in scaleset_name_aliases: - c.argument(dest, vmss_name_type, id_part=None) # due to instance-ids parameter - - with self.argument_context('vmss deallocate', operation_group='virtual_machine_scale_sets') as c: - c.argument('hibernate', arg_type=get_three_state_flag(), help='Hibernate a virtual machine from the VM scale set. Available for VMSS with Flexible OrchestrationMode only.', min_api='2023-03-01') - - with self.argument_context('vmss reimage') as c: - c.argument('instance_ids', nargs='+', - help='Space-separated list of VM instance ID. If missing, reimage all instances.', - options_list=['--instance-ids', c.deprecate(target='--instance-id', redirect='--instance-ids', hide=True)]) - c.argument('force_update_os_disk_for_ephemeral', options_list=['--force-update-os-disk-for-ephemeral', '--update-os-disk'], arg_type=get_three_state_flag(), min_api='2024-03-01', help='Force update ephemeral OS disk for a virtual machine scale set VM.') - - with self.argument_context('vmss create', operation_group='virtual_machine_scale_sets') as c: - VirtualMachineEvictionPolicyTypes = self.get_models('VirtualMachineEvictionPolicyTypes', resource_type=ResourceType.MGMT_COMPUTE) - - c.argument('name', name_arg_type) - c.argument('nat_backend_port', default=None, help='Backend port to open with NAT rules. Defaults to 22 on Linux and 3389 on Windows.') - c.argument('single_placement_group', arg_type=get_three_state_flag(), help="Limit the scale set to a single placement group." - " See https://learn.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-placement-groups for details.") - c.argument('platform_fault_domain_count', type=int, help='Fault Domain count for each placement group in the availability zone', min_api='2017-12-01') - c.argument('vmss_name', name_arg_type, id_part=None, help='Name of the virtual machine scale set.') - c.argument('instance_count', help='Number of VMs in the scale set.', type=int) - c.argument('disable_overprovision', help='Overprovision option (see https://azure.microsoft.com/documentation/articles/virtual-machine-scale-sets-overview/ for details).', action='store_true') - c.argument('health_probe', help='Probe name from the existing load balancer, mainly used for rolling upgrade or automatic repairs') - c.argument('vm_sku', help='Size of VMs in the scale set. Default to "Standard_DS1_v2". See https://azure.microsoft.com/pricing/details/virtual-machines/ for size info.') - c.argument('nsg', help='Name or ID of an existing Network Security Group.', arg_group='Network') - c.argument('eviction_policy', resource_type=ResourceType.MGMT_COMPUTE, min_api='2017-12-01', arg_type=get_enum_type(VirtualMachineEvictionPolicyTypes, default=None), - help="The eviction policy for virtual machines in a Spot priority scale set. Default eviction policy is Deallocate for a Spot priority scale set") - c.argument('application_security_groups', resource_type=ResourceType.MGMT_COMPUTE, min_api='2018-06-01', nargs='+', options_list=['--asgs'], help='Space-separated list of existing application security groups to associate with the VM.', arg_group='Network', validator=validate_asg_names_or_ids) - c.argument('computer_name_prefix', help='Computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long') - c.argument('orchestration_mode', help='Choose how virtual machines are managed by the scale set. In Uniform mode, you define a virtual machine model and Azure will generate identical instances based on that model. In Flexible mode, you manually create and add a virtual machine of any configuration to the scale set or generate identical instances based on virtual machine model defined for the scale set.', - arg_type=get_enum_type(['Uniform', 'Flexible']), default='Flexible', min_api='2020-12-01') - c.argument('orchestration_mode', help='Choose how virtual machines are managed by the scale set. In Uniform mode, you define a virtual machine model and Azure will generate identical instances based on that model.', - arg_type=get_enum_type(['Uniform']), default='Uniform', max_api='2020-09-30') - c.argument('scale_in_policy', scale_in_policy_type) - c.argument('automatic_repairs_grace_period', min_api='2018-10-01', - help='The amount of time (in minutes, between 30 and 90) for which automatic repairs are suspended due to a state change on VM.') - c.argument('automatic_repairs_action', arg_type=get_enum_type(['Replace', 'Restart', 'Reimage']), min_api='2021-11-01', help='Type of repair action that will be used for repairing unhealthy virtual machines in the scale set.') - c.argument('user_data', help='UserData for the virtual machines in the scale set. It can be passed in as file or string.', completer=FilesCompleter(), type=file_type, min_api='2021-03-01') - c.argument('network_api_version', min_api='2021-03-01', - help="Specify the Microsoft.Network API version used when creating networking resources in the Network " - "Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. Default " - "value is 2020-11-01.") - c.argument('enable_spot_restore', arg_type=get_three_state_flag(), min_api='2021-04-01', help='Enable the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based on capacity availability and pricing constraints') - c.argument('spot_restore_timeout', min_api='2021-04-01', help='Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances') - c.argument('enable_agent', arg_type=get_three_state_flag(), min_api='2018-06-01', - help='Indicate whether virtual machine agent should be provisioned on the virtual machine. When this property is not specified, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later') - c.argument('enable_auto_update', arg_type=get_three_state_flag(), min_api='2020-06-01', - help='Indicate whether Automatic Updates is enabled for the Windows virtual machine') - c.argument('patch_mode', arg_type=get_enum_type(['AutomaticByOS', 'AutomaticByPlatform', 'Manual', 'ImageDefault']), min_api='2020-12-01', - help='Mode of in-guest patching to IaaS virtual machine. Allowed values for Windows VM: AutomaticByOS, AutomaticByPlatform, Manual. Allowed values for Linux VM: AutomaticByPlatform, ImageDefault. Manual - You control the application of patches to a virtual machine. You do this by applying patches manually inside the VM. In this mode, automatic updates are disabled; the paramater --enable-auto-update must be false. AutomaticByOS - The virtual machine will automatically be updated by the OS. The parameter --enable-auto-update must be true. AutomaticByPlatform - the virtual machine will automatically updated by the OS. ImageDefault - The virtual machine\'s default patching configuration is used. The parameter --enable-agent and --enable-auto-update must be true') - c.argument('enable_hibernation', arg_type=get_three_state_flag(), min_api='2021-03-01', help='The flag that enable or disable hibernation capability on the VMSS.') - c.argument('security_type', security_type) - c.argument('enable_secure_boot', enable_secure_boot_type) - c.argument('enable_vtpm', enable_vtpm_type) - c.argument('os_disk_delete_option', arg_type=get_enum_type(self.get_models('DiskDeleteOptionTypes')), min_api='2022-03-01', arg_group='Storage', help='Specify whether OS disk should be deleted or detached upon VMSS Flex deletion (This feature is only for VMSS with flexible orchestration mode).') - c.argument('data_disk_delete_option', arg_type=get_enum_type(self.get_models('DiskDeleteOptionTypes')), min_api='2022-03-01', arg_group='Storage', help='Specify whether data disk should be deleted or detached upon VMSS Flex deletion (This feature is only for VMSS with flexible orchestration mode)') - c.argument('security_posture_reference_id', min_api='2023-03-01', - options_list=['--security-posture-reference-id', '--security-posture-id'], - help='The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest') - c.argument('security_posture_reference_exclude_extensions', min_api='2023-03-01', type=validate_file_or_dict, - options_list=['--security-posture-reference-exclude-extensions', '--exclude-extensions'], - help='List of virtual machine extensions to exclude when applying the Security Posture. Either a Json string or a file path is acceptable. ' - 'Please refer to https://learn.microsoft.com/rest/api/compute/virtualmachinescalesets/get#virtualmachineextension for the data format.') - c.argument('skuprofile_vmsizes', nargs='+', min_api='2024-07-01', help='A list of VM sizes in the scale set. See https://azure.microsoft.com/pricing/details/virtual-machines/ for size info.') - c.argument('skuprofile_allostrat', options_list=['--skuprofile-allocation-strategy', '--sku-allocat-strat'], arg_type=get_enum_type(['LowestPrice', 'CapacityOptimized']), min_api='2024-07-01', help='Allocation strategy for vm sizes in SKU profile.') - - with self.argument_context('vmss create', arg_group='Network Balancer') as c: - c.argument('application_gateway', help='Name to use when creating a new application gateway (default) or referencing an existing one. Can also reference an existing application gateway by ID or specify "" for none.', options_list=['--app-gateway']) - c.argument('app_gateway_capacity', help='The number of instances to use when creating a new application gateway.') - c.argument('app_gateway_sku', help='SKU when creating a new application gateway.') - c.argument('app_gateway_subnet_address_prefix', help='The subnet IP address prefix to use when creating a new application gateway in CIDR format.') - c.argument('backend_pool_name', help='Name to use for the backend pool when creating a new load balancer or application gateway.') - c.argument('backend_port', help='When creating a new load balancer, backend port to open with NAT rules (Defaults to 22 on Linux and 3389 on Windows). When creating an application gateway, the backend port to use for the backend HTTP settings.', type=int) - c.argument('load_balancer', help='Name to use when creating a new load balancer (default) or referencing an existing one. Can also reference an existing load balancer by ID or specify "" for none.', options_list=['--load-balancer', '--lb']) - c.argument('load_balancer_sku', resource_type=ResourceType.MGMT_NETWORK, min_api='2017-08-01', max_api='2021-02-01', options_list=['--lb-sku'], arg_type=get_enum_type(['Basic', 'Standard']), - help="Sku of the Load Balancer to create. Default to 'Standard' when single placement group is turned off; otherwise, default to 'Basic'. The public IP is supported to be created on edge zone only when it is 'Standard'") - c.argument('load_balancer_sku', resource_type=ResourceType.MGMT_NETWORK, min_api='2021-02-01', options_list=['--lb-sku'], arg_type=get_enum_type(['Basic', 'Standard', 'Gateway'], default='Standard'), - help="Sku of the Load Balancer to create. The public IP is supported to be created on edge zone only when it is 'Standard'") - c.argument('nat_pool_name', help='Name to use for the NAT pool when creating a new load balancer.', options_list=['--lb-nat-pool-name', '--nat-pool-name'], deprecate_info=c.deprecate(target='--nat-pool-name', redirect='--nat-rule-name', hide=True)) - c.argument('nat_rule_name', help='Name to use for the NAT rule v2 when creating a new load balancer. (NAT rule V2 is used to replace NAT pool)', options_list=['--lb-nat-rule-name', '--nat-rule-name']) - - with self.argument_context('vmss create', min_api='2017-03-30', arg_group='Network') as c: - c.argument('public_ip_per_vm', action='store_true', help="Each VM instance will have a public ip. For security, you can use '--nsg' to apply appropriate rules") - c.argument('vm_domain_name', help="domain name of VM instances, once configured, the FQDN is `vm..<..rest..>`") - c.argument('dns_servers', nargs='+', help="space-separated IP addresses of DNS servers, e.g. 10.0.0.5 10.0.0.6") - c.argument('accelerated_networking', arg_type=get_three_state_flag(), - help="enable accelerated networking. Unless specified, CLI will enable it based on machine image and size") - - with self.argument_context('vmss update') as c: - protection_policy_type = CLIArgumentType(overrides=get_three_state_flag(), arg_group="Protection Policy", min_api='2019-03-01') - c.argument('protect_from_scale_in', arg_type=protection_policy_type, help="Protect the VM instance from scale-in operations.") - c.argument('protect_from_scale_set_actions', arg_type=protection_policy_type, help="Protect the VM instance from scale set actions (including scale-in).") - c.argument('enable_terminate_notification', min_api='2019-03-01', arg_type=get_three_state_flag(), - help='Enable terminate notification') - c.argument('ultra_ssd_enabled', ultra_ssd_enabled_type) - c.argument('scale_in_policy', scale_in_policy_type) - c.argument('force_deletion', action='store_true', is_preview=True, help='This property allow you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.') - c.argument('user_data', help='UserData for the virtual machines in the scale set. It can be passed in as file or string. If empty string is passed in, the existing value will be deleted.', completer=FilesCompleter(), type=file_type, min_api='2021-03-01') - c.argument('enable_spot_restore', arg_type=get_three_state_flag(), min_api='2021-04-01', - help='Enable the Spot-Try-Restore feature where evicted VMSS SPOT instances will be tried to be restored opportunistically based on capacity availability and pricing constraints') - c.argument('spot_restore_timeout', min_api='2021-04-01', - help='Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances') - c.argument('vm_sku', help='The new size of the virtual machine instances in the scale set. Default to "Standard_DS1_v2". See https://azure.microsoft.com/pricing/details/virtual-machines/ for size info.', is_preview=True) - c.argument('ephemeral_os_disk_placement', arg_type=ephemeral_placement_type, - help='Only applicable when used with `--vm-sku`. Allows you to choose the Ephemeral OS disk provisioning location.') - c.argument('enable_hibernation', arg_type=get_three_state_flag(), min_api='2021-03-01', help='The flag that enable or disable hibernation capability on the VMSS.') - c.argument('enable_secure_boot', enable_secure_boot_type) - c.argument('enable_vtpm', enable_vtpm_type) - c.argument('custom_data', help='Custom init script file or text (cloud-init, cloud-config, etc..)', completer=FilesCompleter(), type=file_type) - c.argument('security_type', arg_type=get_enum_type(["TrustedLaunch", "Standard"]), min_api='2020-06-01', help='Specify the security type of the virtual machine scale set.') - c.argument('security_posture_reference_id', min_api='2023-03-01', - options_list=['--security-posture-reference-id', '--security-posture-id'], - help='The security posture reference id in the form of /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest') - c.argument('security_posture_reference_exclude_extensions', min_api='2023-03-01', type=validate_file_or_dict, - options_list=['--security-posture-reference-exclude-extensions', '--exclude-extensions'], - help='List of virtual machine extensions to exclude when applying the Security Posture. Either a Json string or a file path is acceptable. ' - 'Please refer to https://learn.microsoft.com/rest/api/compute/virtualmachinescalesets/get#virtualmachineextension for the data format.') - c.argument('ephemeral_os_disk', arg_type=get_three_state_flag(), min_api='2024-03-01', help='Allow you to specify the ephemeral disk settings for the operating system disk. Specify it to false to set ephemeral disk setting as empty and migrate it to non ephemeral') - c.argument('ephemeral_os_disk_option', options_list=['--ephemeral-os-disk-option', '--ephemeral-option'], arg_type=get_enum_type(self.get_models('DiffDiskOptions')), min_api='2024-03-01', help='Specify the ephemeral disk settings for operating system disk.') - c.argument('zones', zones_type, min_api='2023-03-01') - c.argument('skuprofile_vmsizes', nargs='+', min_api='2024-07-01', help='A list of VM sizes in the scale set. See https://azure.microsoft.com/pricing/details/virtual-machines/ for size info.') - c.argument('skuprofile_allostrat', options_list=['--skuprofile-allocation-strategy', '--sku-allocat-strat'], arg_type=get_enum_type(['LowestPrice', 'CapacityOptimized']), min_api='2024-07-01', help='Allocation strategy for vm sizes in SKU profile.') - - with self.argument_context('vmss update', min_api='2018-10-01', arg_group='Automatic Repairs') as c: - - c.argument('enable_automatic_repairs', arg_type=get_three_state_flag(), help='Enable automatic repairs') - c.argument( - 'automatic_repairs_grace_period', - help='The amount of time (in minutes, between 30 and 90) for which automatic repairs are suspended due to a state change on VM.' - ) - c.argument('automatic_repairs_action', arg_type=get_enum_type(['Replace', 'Restart', 'Reimage']), min_api='2021-11-01', help='Type of repair action that will be used for repairing unhealthy virtual machines in the scale set.') - - for scope in ['vmss create', 'vmss update']: - with self.argument_context(scope) as c: - c.argument('terminate_notification_time', min_api='2019-03-01', - help='Length of time (in minutes, between 5 and 15) a notification to be sent to the VM on the instance metadata server till the VM gets deleted') - c.argument('max_batch_instance_percent', type=int, min_api='2020-12-01', - help='The maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. Default: 20%') - c.argument('max_unhealthy_instance_percent', type=int, min_api='2020-12-01', - help='The maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy. Default: 20%') - c.argument('max_unhealthy_upgraded_instance_percent', type=int, min_api='2020-12-01', - help='The maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. Default: 20%') - c.argument('pause_time_between_batches', min_api='2020-12-01', - help='The wait time between completing the update for all virtual machines in one batch and starting the next batch. Default: 0 seconds') - c.argument('enable_cross_zone_upgrade', arg_type=get_three_state_flag(), min_api='2020-12-01', - help='Set this Boolean property will allow VMSS to ignore AZ boundaries when constructing upgrade batches, and only consider Update Domain and maxBatchInstancePercent to determine the batch size') - c.argument('prioritize_unhealthy_instances', arg_type=get_three_state_flag(), min_api='2020-12-01', - help='Set this Boolean property will lead to all unhealthy instances in a scale set getting upgraded before any healthy instances') - c.argument('max_surge', arg_type=get_three_state_flag(), min_api='2022-11-01', is_preview=True, - help='Specify it to create new virtual machines to upgrade the scale set, rather than updating the existing virtual machines.') - c.argument('regular_priority_count', type=int, min_api='2022-08-01', is_preview=True, help='The base number of regular priority VMs that will be created in this scale set as it scales out. Must be greater than 0.') - c.argument('regular_priority_percentage', type=int, min_api='2022-08-01', is_preview=True, help='The percentage of VM instances, after the base regular priority count has been reached, that are expected to use regular priority. Must be between 0 and 100.') - c.argument('enable_osimage_notification', arg_type=get_three_state_flag(), min_api='2022-11-01', help='Specify whether the OS Image Scheduled event is enabled or disabled.') - c.argument('enable_resilient_creation', arg_type=get_three_state_flag(), min_api='2023-09-01', help='Automatically recover customers from OS Provisioning Timeout and VM Start Timeout errors experienced during a VM Create operation by deleting and recreating the affected VM.') - c.argument('enable_resilient_deletion', arg_type=get_three_state_flag(), min_api='2023-09-01', help='Retry VM Delete requests asynchronously in the event of a failed delete operation.') - c.argument('additional_scheduled_events', options_list=['--additional-scheduled-events', '--scheduled-event-additional-publishing-target-event-grid-and-resource-graph', '--additional-events'], arg_type=get_three_state_flag(), min_api='2024-03-01', help='The configuration parameter used while creating event grid and resource graph scheduled event setting.') - c.argument('enable_user_reboot_scheduled_events', options_list=['--enable-user-reboot-scheduled-events', '--enable-reboot'], arg_type=get_three_state_flag(), min_api='2024-03-01', help='The configuration parameter used while publishing scheduled events additional publishing targets.') - c.argument('enable_user_redeploy_scheduled_events', options_list=['--enable-user-redeploy-scheduled-events', '--enable-redeploy'], arg_type=get_three_state_flag(), min_api='2024-03-01', help='The configuration parameter used while creating user initiated redeploy scheduled event setting creation.') - c.argument('enable_auto_os_upgrade', enable_auto_os_upgrade_type) - c.argument('upgrade_policy_mode', help='Specify the mode of an upgrade to virtual machines in the scale set.', arg_type=get_enum_type(UpgradeMode)) - - with self.argument_context('vmss update') as c: - c.argument('instance_id', id_part='child_name_1', help="Update the VM instance with this ID. If missing, update the VMSS.") - with self.argument_context('vmss wait') as c: - c.argument('instance_id', id_part='child_name_1', help="Wait on the VM instance with this ID. If missing, wait on the VMSS.") - - for scope in ['vmss update-instances', 'vmss delete-instances']: - with self.argument_context(scope) as c: - c.argument('instance_ids', multi_ids_type, help='Space-separated list of IDs (ex: 1 2 3 ...) or * for all instances.') - - with self.argument_context('vmss diagnostics') as c: - c.argument('vmss_name', id_part=None, help='Scale set name') - - with self.argument_context('vmss disk') as c: - options_list = ['--vmss-name'] + [c.deprecate(target=opt, redirect='--vmss-name', hide=True)for opt in name_arg_type.settings['options_list']] - new_vmss_name_type = CLIArgumentType(overrides=vmss_name_type, options_list=options_list) - - c.argument('lun', type=int, help='0-based logical unit number (LUN). Max value depends on the Virtual Machine instance size.') - c.argument('size_gb', options_list=['--size-gb', '-z'], help='size in GB. Max size: 4095 GB (certain preview disks can be larger).', type=int) - c.argument('vmss_name', new_vmss_name_type, completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachineScaleSets')) - c.argument('disk', validator=validate_vmss_disk, help='existing disk name or ID to attach or detach from VM instances', - min_api='2017-12-01', completer=get_resource_name_completion_list('Microsoft.Compute/disks')) - c.argument('instance_id', help='Scale set VM instance id', min_api='2017-12-01') - c.argument('sku', arg_type=disk_sku, help='Underlying storage SKU') - - with self.argument_context('vmss encryption') as c: - c.argument('vmss_name', vmss_name_type, completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachineScaleSets')) - - with self.argument_context('vmss extension') as c: - c.argument('extension_name', name_arg_type, help='Name of the extension.') - c.argument('vmss_name', vmss_name_type, options_list=['--vmss-name'], id_part=None) - - with self.argument_context('vmss set-orchestration-service-state') as c: - c.argument('service_name', arg_type=get_enum_type(OrchestrationServiceNames), help='The name of the orchestration service.') - c.argument('action', arg_type=get_enum_type(OrchestrationServiceStateAction), help='The action to be performed.') - # endregion - - # region VM & VMSS Shared - for scope in ['vm', 'vmss']: - with self.argument_context(scope) as c: - c.argument('no_auto_upgrade', - options_list=['--no-auto-upgrade-minor-version', c.deprecate(target='--no-auto-upgrade', redirect='--no-auto-upgrade-minor-version')], - arg_type=get_three_state_flag(), - help='If set, the extension service will not automatically pick or upgrade to the latest minor version, even if the extension is redeployed.') - - for scope in ['vm', 'vmss']: - with self.argument_context('{} run-command'.format(scope)) as c: - c.argument('command_id', completer=get_vm_run_command_completion_list, help="The command id. Use 'az {} run-command list' to get the list".format(scope)) - if scope == 'vmss': - c.argument('vmss_name', vmss_name_type) - - for scope in ['vm', 'vmss']: - with self.argument_context('{} run-command invoke'.format(scope)) as c: - c.argument('parameters', nargs='+', help="space-separated parameters in the format of '[name=]value'") - c.argument('scripts', nargs='+', help="Space-separated script lines. Use @{file} to load script from a file") - - for scope in ['vm', 'vmss']: - with self.argument_context('{} stop'.format(scope)) as c: - c.argument('skip_shutdown', action='store_true', help='Skip shutdown and power-off immediately.', min_api='2019-03-01') - - run_cmd_name_type = CLIArgumentType(options_list=['--name', '--run-command-name'], help='The name of the virtual machine run command.') - run_cmd_vm_name = CLIArgumentType(options_list=['--vm-name'], help='The name of the virtual machine') - for scope in ['create', 'update']: - with self.argument_context('vm run-command {}'.format(scope)) as c: - c.argument('vm_name', run_cmd_vm_name) - c.argument('run_command_name', run_cmd_name_type) - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type) - c.argument('script', help='Contain the powershell or bash script to execute on the VM.') - c.argument('script_uri', help='Contain a uri to the script to execute on the VM. Uri can be any link accessible from the VM or a storage blob without SAS. If subscription has access to the storage blob, then SAS will be auto-generated. ') - c.argument('command_id', help='Specify a command id of predefined script. All command ids can be listed using "list" command.') - c.argument('parameters', nargs='+', help='Set custom parameters in a name-value pair.') - c.argument('protected_parameters', nargs='+', help='Set custom parameters in a name-value pair. These parameters will be encrypted during transmission and will not be logged.') - c.argument('async_execution', arg_type=get_three_state_flag(), help='Optional. If set to true, provisioning ' - 'will complete as soon as the script starts and will not wait for script to complete.') - c.argument('run_as_user', help='By default script process runs under system/root user. Specify custom user to host the process.') - c.argument('run_as_password', help='Password if needed for using run-as-user parameter. It will be encrypted and not logged. ') - c.argument('timeout_in_seconds', type=int, help='The timeout in seconds to execute the run command.') - c.argument('output_blob_uri', help='Specify the Azure storage blob (SAS URI) where script output stream will be uploaded.') - c.argument('error_blob_uri', help='Specify the Azure storage blob where script error stream will be uploaded.') - - with self.argument_context('vm run-command delete') as c: - c.argument('vm_name', run_cmd_vm_name) - c.argument('run_command_name', run_cmd_name_type) - - with self.argument_context('vm run-command list') as c: - c.argument('vm_name', run_cmd_vm_name, id_part=None) - c.argument('expand', help='The expand expression to apply on the operation.') - c.argument('location', arg_type=get_location_type(self.cli_ctx)) - - with self.argument_context('vm run-command show') as c: - c.argument('vm_name', run_cmd_vm_name) - c.argument('run_command_name', run_cmd_name_type) - c.argument('expand', help='The expand expression to apply on the operation.', deprecate_info=c.deprecate(hide=True)) - c.argument('instance_view', action='store_true', help='The instance view of a run command.') - c.argument('location', arg_type=get_location_type(self.cli_ctx)) - c.argument('command_id', help='The command id.') - - with self.argument_context('vm run-command wait') as c: - c.argument('vm_name', run_cmd_vm_name) - c.argument('run_command_name', run_cmd_name_type) - c.argument('expand', help='The expand expression to apply on the operation.', deprecate_info=c.deprecate(hide=True)) - c.argument('instance_view', action='store_true', help='The instance view of a run command.') - c.argument('location', arg_type=get_location_type(self.cli_ctx)) - c.argument('command_id', help='The command id.') - - run_cmd_vmss_name = CLIArgumentType(options_list=['--vmss-name'], help='The name of the VM scale set.') - for scope in ['create', 'update']: - with self.argument_context('vmss run-command {}'.format(scope)) as c: - c.argument('vmss_name', run_cmd_vmss_name) - c.argument('instance_id', help='The instance ID of the virtual machine.') - c.argument('run_command_name', run_cmd_name_type) - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type) - c.argument('script', help='Contain the powershell or bash script to execute on the VM.') - c.argument('script_uri', - help='Contain a uri to the script to execute on the VM. Uri can be any link accessible from the VM or a storage blob without SAS. If subscription has access to the storage blob, then SAS will be auto-generated. ') - c.argument('command_id', - help='Specify a command id of predefined script. All command ids can be listed using "list" command.') - c.argument('parameters', nargs='+', help='Set custom parameters in a name-value pair.') - c.argument('protected_parameters', nargs='+', - help='Set custom parameters in a name-value pair. These parameters will be encrypted during transmission and will not be logged.') - c.argument('async_execution', arg_type=get_three_state_flag(), help='Optional. If set to true, provisioning ' - 'will complete as soon as the script starts and will not wait for script to complete.') - c.argument('run_as_user', - help='By default script process runs under system/root user. Specify custom user to host the process.') - c.argument('run_as_password', - help='Password if needed for using run-as-user parameter. It will be encrypted and not logged. ') - c.argument('timeout_in_seconds', type=int, help='The timeout in seconds to execute the run command.') - c.argument('output_blob_uri', help='Uri (without SAS) to an append blob where the script output will be uploaded.') - c.argument('error_blob_uri', help='Uri (without SAS) to an append blob where the script error stream will be uploaded.') - - with self.argument_context('vmss run-command delete') as c: - c.argument('vmss_name', run_cmd_vmss_name) - c.argument('instance_id', help='The instance ID of the virtual machine.') - c.argument('run_command_name', run_cmd_name_type) - - with self.argument_context('vmss run-command list') as c: - c.argument('vmss_name', run_cmd_vmss_name, id_part=None) - c.argument('instance_id', help='The instance ID of the virtual machine.') - c.argument('expand', help='The expand expression to apply on the operation.') - - with self.argument_context('vmss run-command show') as c: - c.argument('vmss_name', run_cmd_vmss_name) - c.argument('instance_id', help='The instance ID of the virtual machine.') - c.argument('run_command_name', run_cmd_name_type) - c.argument('expand', help='The expand expression to apply on the operation.', deprecate_info=c.deprecate(hide=True)) - c.argument('instance_view', action='store_true', help='The instance view of a run command.') - - for scope in ['vm identity assign', 'vmss identity assign']: - with self.argument_context(scope) as c: - c.argument('assign_identity', options_list=['--identities'], nargs='*', help="Space-separated identities to assign. Use '{0}' to refer to the system assigned identity. Default: '{0}'".format(MSI_LOCAL_ID)) - c.argument('vm_name', existing_vm_name) - c.argument('vmss_name', vmss_name_type) - - for scope in ['vm identity remove', 'vmss identity remove']: - with self.argument_context(scope) as c: - c.argument('identities', nargs='+', help="Space-separated identities to remove. Use '{0}' to refer to the system assigned identity. Default: '{0}'".format(MSI_LOCAL_ID)) - c.argument('vm_name', existing_vm_name) - c.argument('vmss_name', vmss_name_type) - - for scope in ['vm identity show', 'vmss identity show']: - with self.argument_context(scope) as c: - c.argument('vm_name', existing_vm_name) - c.argument('vmss_name', vmss_name_type) - - for scope in ['vm application set', 'vmss application set']: - with self.argument_context(scope) as c: - c.argument('vm', existing_vm_name) - c.argument('vmss_name', vmss_name_type) - c.argument('application_version_ids', options_list=['--app-version-ids'], nargs='*', help="Space-separated application version ids to set to VM.") - c.argument('order_applications', action='store_true', help='Whether to set order index at each gallery application. If specified, the first app version id gets specified an order = 1, then the next one 2, and so on. This parameter is meant to be used when the VMApplications specified by app version ids must be installed in a particular order; the lowest order is installed first.') - c.argument('application_configuration_overrides', options_list=['--app-config-overrides'], nargs='*', - help='Space-separated application configuration overrides for each application version ids. ' - 'It should have the same number of items as the application version ids. Null is available for a application ' - 'which does not have a configuration override.') - c.argument('treat_deployment_as_failure', nargs='*', help="Space-separated list of true or false corresponding to the application version ids. If set to true, failure to install or update gallery application version operation will fail this operation") - - for scope in ['vm application list', 'vmss application list']: - with self.argument_context(scope) as c: - c.argument('vm_name', options_list=['--vm-name', '--name', '-n'], arg_type=existing_vm_name, id_part=None) - c.argument('vmss_name', vmss_name_type, id_part=None) - - for scope in ['vm create', 'vmss create']: - with self.argument_context(scope) as c: - c.argument('location', get_location_type(self.cli_ctx), help='Location in which to create VM and related resources. If default location is not configured, will default to the resource group\'s location') - c.argument('tags', tags_type) - c.argument('no_wait', help='Do not wait for the long-running operation to finish.') - c.argument('validate', options_list=['--validate'], help='Generate and validate the ARM template without creating any resources.', action='store_true') - c.argument('size', help='The VM size to be created. See https://azure.microsoft.com/pricing/details/virtual-machines/ for size info.') - c.argument('image', completer=get_urn_aliases_completion_list) - c.argument('custom_data', help='Custom init script file or text (cloud-init, cloud-config, etc..)', completer=FilesCompleter(), type=file_type) - c.argument('secrets', multi_ids_type, help='One or many Key Vault secrets as JSON strings or files via `@{path}` containing `[{ "sourceVault": { "id": "value" }, "vaultCertificates": [{ "certificateUrl": "value", "certificateStore": "cert store name (only on windows)"}] }]`', type=file_type, completer=FilesCompleter()) - c.argument('assign_identity', nargs='*', arg_group='Managed Service Identity', help="accept system or user assigned identities separated by spaces. Use '[system]' to refer system assigned identity, or a resource id to refer user assigned identity. Check out help for more examples") - c.ignore('aux_subscriptions') - c.argument('edge_zone', edge_zone_type) - c.argument('accept_term', action='store_true', help="Accept the license agreement and privacy statement.") - c.argument('disable_integrity_monitoring', action='store_true', min_api='2020-12-01', help='Disable installing guest attestation extension and enabling System Assigned Identity for Trusted Launch enabled VMs and VMSS. It will become the default behavior, so it will become useless', deprecate_info=c.deprecate(hide=True)) - c.argument('enable_integrity_monitoring', action='store_true', min_api='2020-12-01', help='Enable installing Microsoft propietary and not security supported guest attestation extension and enabling System Assigned Identity for Trusted Launch enabled VMs and VMSS.') - c.argument('os_disk_security_encryption_type', arg_type=get_enum_type(self.get_models('SecurityEncryptionTypes')), min_api='2021-11-01', help='Specify the encryption type of the OS managed disk.') - c.argument('os_disk_secure_vm_disk_encryption_set', min_api='2021-11-01', help='Specify the customer managed disk encryption set resource ID or name for the managed disk that is used for customer managed key encrypted Confidential VM OS disk and VM guest blob.') - c.argument('disable_integrity_monitoring_autoupgrade', action='store_true', min_api='2020-12-01', help='Disable auto upgrade of guest attestation extension for Trusted Launch enabled VMs and VMSS.') - - for scope in ['vm create', 'vmss create']: - with self.argument_context(scope, arg_group='Authentication') as c: - c.argument('generate_ssh_keys', action='store_true', help='Generate SSH public and private key files if missing. The keys will be stored in the ~/.ssh directory') - c.argument('ssh_key_type', arg_type=get_enum_type(['RSA', 'Ed25519']), default='RSA', min_api='2023-09-01', help='Specify the type of SSH public and private key files to be generated if missing.') - c.argument('admin_username', help='Username for the VM. Default value is current username of OS. If the default value is system reserved, then default value will be set to azureuser. Please refer to https://learn.microsoft.com/rest/api/compute/virtualmachines/createorupdate#osprofile to get a full list of reserved values.') - c.argument('admin_password', help="Password for the VM if authentication type is 'Password'.") - c.argument('ssh_key_value', options_list=['--ssh-key-values'], completer=FilesCompleter(), type=file_type, nargs='+') - c.argument('ssh_dest_key_path', help='Destination file path on the VM for the SSH key. If the file already exists, the specified key(s) are appended to the file. Destination path for SSH public keys is currently limited to its default value "/home/username/.ssh/authorized_keys" due to a known issue in Linux provisioning agent.') - c.argument('authentication_type', help='Type of authentication to use with the VM. Defaults to password for Windows and SSH public key for Linux. "all" enables both ssh and password authentication. ', arg_type=get_enum_type(['ssh', 'password', 'all'])) - - for scope in ['vm create', 'vmss create']: - with self.argument_context(scope, arg_group='Storage') as c: - if DiskStorageAccountTypes: - allowed_values = ", ".join([sku.value for sku in DiskStorageAccountTypes]) - else: - allowed_values = ", ".join(['Premium_LRS', 'Standard_LRS']) - - usage = 'Usage: [--storage-sku SKU | --storage-sku ID=SKU ID=SKU ID=SKU...], where each ID is "os" or a 0-indexed lun.' - allowed_values = 'Allowed values: {}.'.format(allowed_values) - storage_sku_help = 'The SKU of the storage account with which to persist VM. Use a singular sku that would be applied across all disks, ' \ - 'or specify individual disks. {} {}'.format(usage, allowed_values) - - c.argument('os_disk_name', help='The name of the new VM OS disk.') - c.argument('os_type', help='Type of OS installed on a custom VHD. Do not use when specifying an URN or URN alias.', arg_type=get_enum_type(['windows', 'linux'])) - c.argument('storage_account', help="Only applicable when used with `--use-unmanaged-disk`. The name to use when creating a new storage account or referencing an existing one. If omitted, an appropriate storage account in the same resource group and location will be used, or a new one will be created.") - c.argument('storage_sku', nargs='+', help=storage_sku_help) - c.argument('storage_container_name', help="Only applicable when used with `--use-unmanaged-disk`. Name of the storage container for the VM OS disk. Default: vhds") - c.ignore('os_publisher', 'os_offer', 'os_sku', 'os_version', 'storage_profile') - c.argument('use_unmanaged_disk', action='store_true', help='Do not use managed disk to persist VM') - c.argument('os_disk_size_gb', type=int, help='OS disk size in GB to create.') - c.argument('data_disk_sizes_gb', nargs='+', type=int, help='space-separated empty managed data disk sizes in GB to create') - c.ignore('disk_info', 'storage_account_type', 'public_ip_address_type', 'nsg_type', 'nic_type', 'vnet_type', 'load_balancer_type', 'app_gateway_type') - c.argument('os_caching', options_list=[self.deprecate(target='--storage-caching', redirect='--os-disk-caching', hide=True), '--os-disk-caching'], help='Storage caching type for the VM OS disk. Default: ReadWrite', arg_type=get_enum_type(CachingTypes)) - c.argument('data_caching', options_list=['--data-disk-caching'], nargs='+', - help="storage caching type for data disk(s), including 'None', 'ReadOnly', 'ReadWrite', etc. Use a singular value to apply on all disks, or use `= =` to configure individual disk") - c.argument('ultra_ssd_enabled', ultra_ssd_enabled_type) - c.argument('ephemeral_os_disk', arg_type=get_three_state_flag(), min_api='2018-06-01', - help='Allows you to create an OS disk directly on the host node, providing local disk performance and faster VM/VMSS reimage time.') - c.argument('ephemeral_os_disk_placement', arg_type=ephemeral_placement_type, - help='Only applicable when used with `--ephemeral-os-disk`. Allows you to choose the Ephemeral OS disk provisioning location.') - c.argument('os_disk_encryption_set', min_api='2019-07-01', help='Name or ID of disk encryption set for OS disk.') - c.argument('data_disk_encryption_sets', nargs='+', min_api='2019-07-01', - help='Names or IDs (space delimited) of disk encryption sets for data disks.') - c.argument('data_disk_iops', min_api='2019-07-01', nargs='+', type=int, help='Specify the Read-Write IOPS (space delimited) for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB.') - c.argument('data_disk_mbps', min_api='2019-07-01', nargs='+', type=int, help='Specify the bandwidth in MB per second (space delimited) for the managed disk. Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be assigned based on diskSizeGB.') - c.argument('specialized', arg_type=get_three_state_flag(), help='Indicate whether the source image is specialized.') - c.argument('encryption_at_host', arg_type=get_three_state_flag(), help='Enable Host Encryption for the VM or VMSS. This will enable the encryption for all the disks including Resource/Temp disk at host itself.') - - for scope in ['vm create', 'vmss create']: - with self.argument_context(scope, arg_group='Network') as c: - c.argument('vnet_name', help='Name of the virtual network when creating a new one or referencing an existing one.') - c.argument('vnet_address_prefix', help='The IP address prefix to use when creating a new VNet in CIDR format.') - c.argument('subnet', help='The name of the subnet when creating a new VNet or referencing an existing one. Can also reference an existing subnet by ID. If both vnet-name and subnet are omitted, an appropriate VNet and subnet will be selected automatically, or a new one will be created.') - c.argument('subnet_address_prefix', help='The subnet IP address prefix to use when creating a new VNet in CIDR format.') - c.argument('nics', nargs='+', help='Names or IDs of existing NICs to attach to the VM. The first NIC will be designated as primary. If omitted, a new NIC will be created. If an existing NIC is specified, do not specify subnet, VNet, public IP or NSG.') - c.argument('private_ip_address', help='Static private IP address (e.g. 10.0.0.5).') - c.argument('public_ip_address', help='Name of the public IP address when creating one (default) or referencing an existing one. Can also reference an existing public IP by ID or specify "" for None (\'""\' in Azure CLI using PowerShell or --% operator). For Azure CLI using powershell core edition 7.3.4, specify '' or "" (--public-ip-address '' or --public-ip-address "")') - c.argument('public_ip_address_allocation', help=None, default=None, arg_type=get_enum_type(['dynamic', 'static'])) - c.argument('public_ip_address_dns_name', help='Globally unique DNS name for a newly created public IP.') - - if self.supported_api_version(min_api='2017-08-01', resource_type=ResourceType.MGMT_NETWORK): - c.argument('public_ip_sku', help='Public IP SKU. The public IP is supported to be created on edge zone only when it is \'Standard\'', - default='Standard', arg_type=get_enum_type(['Basic', 'Standard'])) - - c.argument('nic_delete_option', nargs='+', min_api='2021-03-01', - help='Specify what happens to the network interface when the VM is deleted. Use a singular ' - 'value to apply on all resources, or use = to configure ' - 'the delete behavior for individual resources. Possible options are Delete and Detach.') - - for scope in ['vm create', 'vmss create']: - with self.argument_context(scope, arg_group='Marketplace Image Plan') as c: - c.argument('plan_name', help='plan name') - c.argument('plan_product', help='plan product') - c.argument('plan_publisher', help='plan publisher') - c.argument('plan_promotion_code', help='plan promotion code') - - for scope in ['vm create', 'vmss create', 'vm identity assign', 'vmss identity assign']: - with self.argument_context(scope) as c: - arg_group = 'Managed Service Identity' if scope.split()[-1] == 'create' else None - c.argument('identity_scope', options_list=['--scope'], arg_group=arg_group, - help="Scope that the system assigned identity can access. ") - c.ignore('identity_role_id') - - for scope in ['vm create', 'vmss create']: - with self.argument_context(scope) as c: - c.argument('identity_role', options_list=['--role'], arg_group='Managed Service Identity', - help='Role name or id the system assigned identity will have. ') - - for scope in ['vm identity assign', 'vmss identity assign']: - with self.argument_context(scope) as c: - c.argument('identity_role', options_list=['--role'], - help='Role name or id the system assigned identity will have.') - - with self.argument_context('vm auto-shutdown') as c: - c.argument('off', action='store_true', help='Turn off auto-shutdown for VM. Configuration will be cleared.') - c.argument('email', help='The email recipient to send notifications to (can be a list of semi-colon separated email addresses)') - c.argument('time', help='The UTC time of day the schedule will occur every day. Format: hhmm. Example: 1730') - c.argument('webhook', help='The webhook URL to which the notification will be sent') - c.argument('location', validator=get_default_location_from_resource_group) - - for scope in ['vm diagnostics', 'vmss diagnostics']: - with self.argument_context(scope) as c: - c.argument('version', help='version of the diagnostics extension. Will use the latest if not specfied') - c.argument('settings', help='json string or a file path, which defines data to be collected.', type=validate_file_or_dict, completer=FilesCompleter()) - c.argument('protected_settings', help='json string or a file path containing private configurations such as storage account keys, etc.', type=validate_file_or_dict, completer=FilesCompleter()) - c.argument('is_windows_os', action='store_true', help='for Windows VMs') - - for scope in ['vm encryption', 'vmss encryption']: - with self.argument_context(scope) as c: - c.argument('volume_type', help='Type of volume that the encryption operation is performed on', arg_type=get_enum_type(['DATA', 'OS', 'ALL'])) - c.argument('force', action='store_true', help='continue by ignoring client side validation errors') - c.argument('disk_encryption_keyvault', help='Name or ID of the key vault where the generated encryption key will be placed.') - c.argument('key_encryption_key', help='Key vault key name or URL used to encrypt the disk encryption key.') - c.argument('key_encryption_keyvault', help='Name or ID of the key vault containing the key encryption key used to encrypt the disk encryption key. If missing, CLI will use `--disk-encryption-keyvault`.') - - for scope in ['vm extension', 'vmss extension']: - with self.argument_context(scope) as c: - c.argument('publisher', help='The name of the extension publisher.') - c.argument('settings', type=validate_file_or_dict, help='Extension settings in JSON format. A JSON file path is also accepted.') - c.argument('protected_settings', type=validate_file_or_dict, help='Protected settings in JSON format for sensitive information like credentials. A JSON file path is also accepted.') - c.argument('version', help='The version of the extension. To pin extension version to this value, please specify --no-auto-upgrade-minor-version.') - c.argument('enable_auto_upgrade', arg_type=get_three_state_flag(), - help='Indicate the extension should be automatically upgraded by the platform if there is a newer version of the extension available.') - - with self.argument_context('vm extension set') as c: - c.argument('vm_extension_name', name_arg_type, - completer=get_resource_name_completion_list('Microsoft.Compute/virtualMachines/extensions'), - help='Name of the extension.', id_part=None) - c.argument('force_update', action='store_true', help='force to update even if the extension configuration has not changed.') - c.argument('extension_instance_name', extension_instance_name_type) - - with self.argument_context('vmss extension set', min_api='2017-12-01') as c: - c.argument('force_update', action='store_true', help='force to update even if the extension configuration has not changed.') - c.argument('extension_instance_name', extension_instance_name_type) - c.argument('provision_after_extensions', nargs='+', help='Space-separated list of extension names after which this extension should be provisioned. These extensions must already be set on the vm.') - - for scope in ['vm extension image', 'vmss extension image']: - with self.argument_context(scope) as c: - c.argument('image_location', options_list=['--location', '-l'], help='Image location.') - c.argument('name', help='Image name', id_part=None) - c.argument('publisher_name', options_list=['--publisher', '-p'], help='Image publisher name') - c.argument('type', options_list=['--name', '-n'], help='Name of the extension') - c.argument('latest', action='store_true', help='Show the latest version only.') - c.argument('version', help='Extension version') - c.argument('orderby', help="the $orderby odata query option") - c.argument('top', help='the $top odata query option') - - for scope in ['vm create', 'vm update', 'vmss create', 'vmss update']: - with self.argument_context(scope) as c: - c.argument('license_type', license_type) - c.argument('priority', resource_type=ResourceType.MGMT_COMPUTE, min_api='2019-03-01', - arg_type=get_enum_type(self.get_models('VirtualMachinePriorityTypes'), default=None), - help="Priority. Use 'Spot' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' to deploy Azure spot VM and/or VMSS. Default to Regular.") - c.argument('max_price', min_api='2019-03-01', type=float, is_preview=True, - help='The maximum price (in US Dollars) you are willing to pay for a Spot VM/VMSS. -1 indicates that the Spot VM/VMSS should not be evicted for price reasons') - c.argument('capacity_reservation_group', options_list=['--capacity-reservation-group', '--crg'], - help='The ID or name of the capacity reservation group that is used to allocate. Pass in "None" to disassociate the capacity reservation group. Please note that if you want to delete a VM/VMSS that has been associated with capacity reservation group, you need to disassociate the capacity reservation group first.', - min_api='2021-04-01', is_preview=True) - c.argument('v_cpus_available', type=int, min_api='2021-11-01', help='Specify the number of vCPUs available') - c.argument('v_cpus_per_core', type=int, min_api='2021-11-01', help='Specify the ratio of vCPU to physical core. Setting this property to 1 also means that hyper-threading is disabled.') - c.argument('disk_controller_type', disk_controller_type) - c.argument('enable_proxy_agent', arg_type=get_three_state_flag(), min_api='2023-09-01', help='Specify whether proxy agent feature should be enabled on the virtual machine or virtual machine scale set.') - c.argument('proxy_agent_mode', arg_type=get_enum_type(self.get_models('Mode')), min_api='2023-09-01', help='Specify the mode that proxy agent will execute on if the feature is enabled.') - - with self.argument_context('vm update') as c: - c.argument('license_type', license_type) - c.argument('user_data', help='UserData for the VM. It can be passed in as file or string. If empty string is passed in, the existing value will be deleted.', completer=FilesCompleter(), type=file_type, min_api='2021-03-01') - - with self.argument_context('vmss create') as c: - c.argument('priority', resource_type=ResourceType.MGMT_COMPUTE, min_api='2017-12-01', - arg_type=get_enum_type(self.get_models('VirtualMachinePriorityTypes'), default=None), - help="Priority. Use 'Spot' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' to deploy Azure spot VM and/or VMSS. Default to Regular.") - - with self.argument_context('sig') as c: - c.argument('gallery_name', options_list=['--gallery-name', '-r'], help='gallery name') - c.argument('gallery_image_name', options_list=['--gallery-image-definition', '-i'], help='gallery image definition') - c.argument('gallery_image_version', options_list=['--gallery-image-version', '-e'], help='gallery image version') - - for scope in ['sig share add', 'sig share remove']: - with self.argument_context(scope) as c: - c.argument('gallery_name', type=str, help='The name of the Shared Image Gallery.', id_part='name') - c.argument('subscription_ids', nargs='+', help='A list of subscription ids to share the gallery.') - c.argument('tenant_ids', nargs='+', help='A list of tenant ids to share the gallery.') - - with self.argument_context('sig share add') as c: - c.argument('op_type', default='Add', deprecate_info=c.deprecate(hide=True), - help='distinguish add operation and remove operation') - - with self.argument_context('sig share remove') as c: - c.argument('op_type', default='Remove', deprecate_info=c.deprecate(hide=True), - help='distinguish add operation and remove operation') - - with self.argument_context('sig share reset') as c: - c.argument('gallery_name', type=str, help='The name of the Shared Image Gallery.', id_part='name') - - with self.argument_context('sig image-definition create') as c: - c.argument('offer', options_list=['--offer', '-f'], help='image offer') - c.argument('sku', options_list=['--sku', '-s'], help='image sku') - c.argument('publisher', options_list=['--publisher', '-p'], help='image publisher') - c.argument('os_type', arg_type=get_enum_type(['Windows', 'Linux']), help='the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD') - c.argument('os_state', arg_type=get_enum_type(self.get_models('OperatingSystemStateTypes')), help="This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'.") - c.argument('hyper_v_generation', arg_type=get_enum_type(self.get_models('HyperVGenerationTypes')), help='The hypervisor generation of the Virtual Machine. Applicable to OS disks only.') - c.argument('minimum_cpu_core', type=int, arg_group='Recommendation', help='minimum cpu cores') - c.argument('maximum_cpu_core', type=int, arg_group='Recommendation', help='maximum cpu cores') - c.argument('minimum_memory', type=int, arg_group='Recommendation', help='minimum memory in MB') - c.argument('maximum_memory', type=int, arg_group='Recommendation', help='maximum memory in MB') - - c.argument('plan_publisher', help='plan publisher', arg_group='Purchase plan') - c.argument('plan_name', help='plan name', arg_group='Purchase plan') - c.argument('plan_product', help='plan product', arg_group='Purchase plan') - - c.argument('eula', help='The Eula agreement for the gallery image') - c.argument('privacy_statement_uri', help='The privacy statement uri') - c.argument('release_note_uri', help='The release note uri') - c.argument('end_of_life_date', help="the end of life date, e.g. '2020-12-31'") - c.argument('disallowed_disk_types', nargs='*', help='disk types which would not work with the image, e.g., Standard_LRS') - c.argument('features', help='A list of gallery image features. E.g. "IsSecureBootSupported=true IsMeasuredBootSupported=false"') - c.argument('architecture', arg_type=get_enum_type(self.get_models('Architecture', operation_group='gallery_images')), min_api='2021-10-01', help='CPU architecture.') - - with self.argument_context('sig image-definition list-shared') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') - c.argument('gallery_unique_name', type=str, help='The unique name of the Shared Gallery.', - id_part='child_name_1') - c.argument('shared_to', shared_to_type) - c.argument('marker', arg_type=marker_type) - c.argument('show_next_marker', action='store_true', help='Show nextMarker in result when specified.') - - with self.argument_context('sig image-definition create') as c: - c.argument('description', help='the description of the gallery image definition') - with self.argument_context('sig image-definition update') as c: - c.ignore('gallery_image') - - with self.argument_context('sig image-version') as c: - deprecated_option = c.deprecate(target='--gallery-image-version-name', redirect='--gallery-image-version', hide=True, expiration="3.0.0") - c.argument('gallery_image_version_name', options_list=['--gallery-image-version', '-e', deprecated_option], - help='Gallery image version in semantic version pattern. The allowed characters are digit and period. Digits must be within the range of a 32-bit integer, e.g. `..`') - - for scope in ['sig image-version create', 'sig image-version undelete']: - with self.argument_context(scope, resource_type=ResourceType.MGMT_COMPUTE, operation_group='gallery_image_versions') as c: - c.argument('gallery_image_version', options_list=['--gallery-image-version', '-e'], - help='Gallery image version in semantic version pattern. The allowed characters are digit and period. Digits must be within the range of a 32-bit integer, e.g. `..`') - - with self.argument_context('sig image-version create', resource_type=ResourceType.MGMT_COMPUTE, operation_group='gallery_image_versions') as c: - c.argument('description', help='the description of the gallery image version') - c.argument('managed_image', help='image name(if in the same resource group) or resource id') - c.argument('os_snapshot', help='Name or ID of OS disk snapshot') - c.argument('data_snapshots', nargs='+', help='Names or IDs (space-delimited) of data disk snapshots') - c.argument('data_snapshot_luns', nargs='+', help='Logical unit numbers (space-delimited) of data disk snapshots') - c.argument('exclude_from_latest', arg_type=get_three_state_flag(), help='The flag means that if it is set to true, people deploying VMs with version omitted will not use this version.') - c.argument('version', help='image version') - c.argument('end_of_life_date', help="the end of life date, e.g. '2020-12-31'") - c.argument('storage_account_type', help="The default storage account type to be used per region. To set regional storage account types, use --target-regions", - arg_type=get_enum_type(["Standard_LRS", "Standard_ZRS", "Premium_LRS"]), min_api='2019-03-01') - c.argument('target_region_encryption', nargs='+', - help='Space-separated list of customer managed keys for encrypting the OS and data disks in the gallery artifact for each region. Format for each region: `,,,,`. Use "null" as a placeholder.') - c.argument('os_vhd_uri', help='Source VHD URI of OS disk') - c.argument('os_vhd_storage_account', help='Name or ID of storage account of source VHD URI of OS disk') - c.argument('data_vhds_uris', nargs='+', help='Source VHD URIs (space-delimited) of data disks') - c.argument('data_vhds_luns', nargs='+', help='Logical unit numbers (space-delimited) of source VHD URIs of data disks') - c.argument('data_vhds_storage_accounts', options_list=['--data-vhds-storage-accounts', '--data-vhds-sa'], nargs='+', help='Names or IDs (space-delimited) of storage accounts of source VHD URIs of data disks') - c.argument('replication_mode', min_api='2021-07-01', arg_type=get_enum_type(ReplicationMode), help='Optional parameter which specifies the mode to be used for replication. This property is not updatable.') - c.argument('virtual_machine', help='Resource id of VM source') - c.argument('image_version', help='Resource id of gallery image version source') - c.argument('target_zone_encryption', nargs='+', min_api='2022-01-03', - options_list=['--target-edge-zone-encryption', '--zone-encryption'], - help='Space-separated list of customer managed keys for encrypting the OS and data disks in the gallery artifact for each region. ' - 'Format for each edge zone: ,,,,,.') - - with self.argument_context('sig image-version list-shared') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') - c.argument('gallery_unique_name', type=str, help='The unique name of the Shared Gallery.', - id_part='child_name_1') - c.argument('gallery_image_name', options_list=['--gallery-image-definition', '-i'], type=str, help='The name ' - 'of the Shared Gallery Image Definition from which the Image Versions are to be listed.', - id_part='child_name_2') - c.argument('shared_to', shared_to_type) - c.argument('marker', arg_type=marker_type) - c.argument('show_next_marker', action='store_true', help='Show nextMarker in result when specified.') - - with self.argument_context('sig image-version show') as c: - c.argument('expand', help="The expand expression to apply on the operation, e.g. 'ReplicationStatus'") - - with self.argument_context('sig image-version show-shared') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') - c.argument('gallery_unique_name', type=str, help='The unique name of the Shared Gallery.', - id_part='child_name_1') - c.argument('gallery_image_name', options_list=['--gallery-image-definition', '-i'], type=str, help='The name ' - 'of the Shared Gallery Image Definition from which the Image Versions are to be listed.', - id_part='child_name_2') - c.argument('gallery_image_version_name', options_list=['--gallery-image-version', '-e'], type=str, help='The ' - 'name of the gallery image version to be created. Needs to follow semantic version name pattern: ' - 'The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. ' - 'Format: ..', id_part='child_name_3') - - for scope in ['sig image-version create', 'sig image-version update']: - with self.argument_context(scope, operation_group='gallery_image_versions') as c: - c.argument('target_regions', nargs='*', - help='Space-separated list of regions and their replica counts. Use `[=][=]` to optionally set the replica count and/or storage account type for each region. ' - 'If a replica count is not specified, the default replica count will be used. If a storage account type is not specified, the default storage account type will be used') - c.argument('replica_count', help='The default number of replicas to be created per region. To set regional replication counts, use --target-regions', type=int) - - for scope in ['sig image-version create', 'sig image-version update', 'sig image-version undelete']: - with self.argument_context(scope, operation_group='gallery_image_versions') as c: - c.argument('allow_replicated_location_deletion', arg_type=get_three_state_flag(), min_api='2022-03-03', help='Indicate whether or not removing this gallery image version from replicated regions is allowed.') - - with self.argument_context('sig list-community') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx)) - c.argument('marker', arg_type=marker_type) - c.argument('show_next_marker', action='store_true', help='Show nextMarker in result when specified.') - - with self.argument_context('sig image-definition show-community') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') - c.argument('public_gallery_name', public_gallery_name_type) - c.argument('gallery_image_name', gallery_image_name_type) - - with self.argument_context('sig image-definition list-community') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') - c.argument('public_gallery_name', public_gallery_name_type) - c.argument('marker', arg_type=marker_type) - c.argument('show_next_marker', action='store_true', help='Show nextMarker in result when specified.') - - with self.argument_context('sig image-version show-community') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') - c.argument('public_gallery_name', public_gallery_name_type) - c.argument('gallery_image_name', gallery_image_name_type) - c.argument('gallery_image_version_name', gallery_image_name_version_type) - - with self.argument_context('sig image-version list-community') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), id_part='name') - c.argument('public_gallery_name', public_gallery_name_type) - c.argument('gallery_image_name', gallery_image_name_type) - c.argument('marker', arg_type=marker_type) - c.argument('show_next_marker', action='store_true', help='Show nextMarker in result when specified.') - - with self.argument_context('sig share enable-community') as c: - c.argument('gallery_name', type=str, help='The name of the Shared Image Gallery.', id_part='name') - c.argument('subscription_ids', nargs='+', help='A list of subscription ids to share the gallery.') - c.argument('tenant_ids', nargs='+', help='A list of tenant ids to share the gallery.') - c.argument('op_type', default='EnableCommunity', deprecate_info=c.deprecate(hide=True), - help='distinguish add operation and remove operation') - - # endregion - - with self.argument_context('vm create', min_api='2018-04-01') as c: - c.argument('proximity_placement_group', options_list=['--ppg'], - help="The name or ID of the proximity placement group the VM should be associated with.", - validator=_validate_proximity_placement_group) - - with self.argument_context('vmss create', min_api='2018-04-01') as c: - c.argument('proximity_placement_group', options_list=['--ppg'], - help="The name or ID of the proximity placement group the VMSS should be associated with.", - validator=_validate_proximity_placement_group) - - with self.argument_context('vm availability-set create', min_api='2018-04-01') as c: - c.argument('proximity_placement_group', options_list=['--ppg'], - help="The name or ID of the proximity placement group the availability set should be associated with.", - validator=_validate_proximity_placement_group) - - with self.argument_context('vm update', min_api='2018-04-01') as c: - c.argument('proximity_placement_group', options_list=['--ppg'], - help="The name or ID of the proximity placement group the VM should be associated with.", - validator=_validate_proximity_placement_group) - - with self.argument_context('vmss update', min_api='2018-04-01') as c: - c.argument('proximity_placement_group', options_list=['--ppg'], - help="The name or ID of the proximity placement group the VMSS should be associated with.", - validator=_validate_proximity_placement_group) - - with self.argument_context('vm availability-set update', min_api='2018-04-01') as c: - c.argument('proximity_placement_group', options_list=['--ppg'], - help="The name or ID of the proximity placement group the availability set should be associated with.", - validator=_validate_proximity_placement_group) - # endregion - - # region VM Monitor - with self.argument_context('vm monitor log show') as c: - c.argument('analytics_query', options_list=['--analytics-query', '-q'], help="Query to execute over Log Analytics data.") - c.argument('timespan', help="Timespan over which to query. Defaults to querying all available data.") - - with self.argument_context('vm monitor metrics') as c: - c.argument('metricnamespace', options_list=['--namespace'], - help='Namespace to query metric definitions for.') - - with self.argument_context('vm monitor metrics tail') as c: - from azure.mgmt.monitor.models import AggregationType - c.extra('resource_group_name', required=True) - c.argument('resource', arg_type=existing_vm_name, help='Name or ID of a virtual machine', validator=validate_vm_name_for_monitor_metrics, id_part=None) - c.argument('metadata', action='store_true') - c.argument('dimension', nargs='*', validator=validate_metric_dimension) - c.argument('aggregation', arg_type=get_enum_type(t for t in AggregationType if t.name != 'none'), nargs='*') - c.argument('metrics', nargs='*') - c.argument('orderby', - help='Aggregation to use for sorting results and the direction of the sort. Only one order can be specificed. Examples: sum asc') - c.argument('top', help='Max number of records to retrieve. Valid only if --filter used.') - c.argument('filters', options_list=['--filter']) - c.argument('metric_namespace', options_list=['--namespace']) - - with self.argument_context('vm monitor metrics tail', arg_group='Time') as c: - c.argument('start_time', arg_type=get_datetime_type(help='Start time of the query.')) - c.argument('end_time', arg_type=get_datetime_type(help='End time of the query. Defaults to the current time.')) - c.argument('offset', type=get_period_type(as_timedelta=True)) - c.argument('interval', arg_group='Time', type=get_period_type()) - - with self.argument_context('vm monitor metrics list-definitions') as c: - c.extra('resource_group_name', required=True) - c.argument('resource_uri', arg_type=existing_vm_name, help='Name or ID of a virtual machine', validator=validate_vm_name_for_monitor_metrics, id_part=None) - # endregion - - # region Capacity - with self.argument_context('capacity reservation group') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) - c.argument('capacity_reservation_group_name', options_list=['--capacity-reservation-group', '-n'], - help='The name of the capacity reservation group.') - c.argument('tags', tags_type) - c.argument('sharing_profile', nargs='*', help='Space-separated subscription resource IDs or nothing. Specify the settings to enable sharing across subscriptions for the capacity reservation group resource. Specify it to nothing to unsharing.') - - with self.argument_context('capacity reservation group create') as c: - c.argument('zones', zones_type, help='Availability Zones to use for this capacity reservation group. If not provided, the group supports only regional resources in the region. If provided, enforces each capacity reservation in the group to be in one of the zones.') - - with self.argument_context('capacity reservation group show') as c: - c.argument('instance_view', action='store_true', options_list=['--instance-view', '-i'], help='Retrieve the list of instance views of the capacity reservations under the capacity reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control plane operations.') - - with self.argument_context('capacity reservation') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group) - c.argument('capacity_reservation_group_name', options_list=['--capacity-reservation-group', '-c'], - help='The name of the capacity reservation group.') - c.argument('capacity_reservation_name', options_list=['--capacity-reservation-name', '-n'], - help='The name of the capacity reservation.') - c.argument('capacity', type=int, help='Specify the number of virtual machines in the scale set.') - c.argument('tags', tags_type) - - with self.argument_context('capacity reservation create') as c: - c.argument('zone', zone_type, help='Availability Zone to use for this capacity reservation. The zone has to be single value and also should be part for the list of zones specified during the capacity reservation group creation. If not provided, the reservation supports only non-zonal deployments. If provided, enforces VM/VMSS using this capacity reservation to be in same zone.') - c.argument('sku_name', options_list=['--sku', '-s'], required=True, help='The SKU of the resource for which capacity needs be reserved. Currently VM Skus with the capability called "CapacityReservationSupported" set to true are supported. Refer to List Microsoft.Compute SKUs in a region (https://learn.microsoft.com/rest/api/compute/resourceskus/list) for supported values.') - - with self.argument_context('capacity reservation show') as c: - c.argument('instance_view', action='store_true', options_list=['--instance-view', '-i'], help='Retrieve a snapshot of the runtime properties of the capacity reservation that is managed by the platform and can change outside of control plane operations.') - # endRegion - - # region Restore point - with self.argument_context('restore-point') as c: - c.argument('restore_point_collection_name', options_list=['--collection-name'], - help='The name of the restore point collection.') - - with self.argument_context('restore-point create') as c: - c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'], - help='The name of the restore point.') - c.argument('exclude_disks', nargs='+', help='List of disk resource ids that the ' - 'customer wishes to exclude from the restore point. If no disks are specified, all disks will be ' - 'included.') - c.argument('source_restore_point', help='Resource Id of the source restore point from which a copy needs to be created') - c.argument('consistency_mode', arg_type=get_enum_type(self.get_models('ConsistencyModeTypes')), is_preview=True, min_api='2021-07-01', help='Consistency mode of the restore point. Can be specified in the input while creating a restore point. For now, only CrashConsistent is accepted as a valid input. Please refer to https://aka.ms/RestorePoints for more details.') - c.argument('source_os_resource', help='Resource Id of the source OS disk') - c.argument('os_restore_point_encryption_set', help='Customer managed OS disk encryption set resource id') - c.argument('os_restore_point_encryption_type', arg_type=get_enum_type(self.get_models('RestorePointEncryptionType')), help='The type of key used to encrypt the data of the OS disk restore point.') - c.argument('source_data_disk_resource', nargs='+', help='Resource Id of the source data disk') - c.argument('data_disk_restore_point_encryption_set', nargs='+', help='Customer managed data disk encryption set resource id') - c.argument('data_disk_restore_point_encryption_type', nargs='+', arg_type=get_enum_type(self.get_models('RestorePointEncryptionType')), help='The type of key used to encrypt the data of the data disk restore point.') - - with self.argument_context('restore-point show') as c: - c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'], - help='The name of the restore point.') - c.argument('expand', help='The expand expression to apply on the operation.', - deprecate_info=c.deprecate(hide=True)) - c.argument('instance_view', action='store_true', help='Show the instance view of a restore point.') - - with self.argument_context('restore-point wait') as c: - c.argument('restore_point_name', options_list=['--name', '-n', '--restore-point-name'], - help='The name of the restore point.') - # endRegion - - # region Restore point collection - with self.argument_context('restore-point collection create') as c: - c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, - validator=get_default_location_from_resource_group) - c.argument('tags', tags_type) - c.argument('source_id', help='Resource Id of the source resource used to create this restore point collection', - arg_group='Source') - - with self.argument_context('restore-point collection update') as c: - c.argument('tags', tags_type) - - with self.argument_context('restore-point collection show') as c: - c.argument('expand', help='The expand expression to apply on the operation.', - deprecate_info=c.deprecate(hide=True)) - c.argument('restore_points', action='store_true', help='Show all contained restore points in the restore point collection.') - # endRegion diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_template_builder.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_template_builder.py deleted file mode 100644 index 6236a6f7d57..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_template_builder.py +++ /dev/null @@ -1,1652 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - - -from enum import Enum - -from knack.log import get_logger -from knack.util import CLIError - -from azure.cli.command_modules.vm.azure_stack._vm_utils import get_target_network_api -from azure.cli.core.azclierror import ValidationError, InvalidArgumentValueError -from azure.cli.core.commands.arm import ArmTemplateBuilder -from azure.cli.core.profiles import ResourceType -from azure.cli.core.util import b64encode - -logger = get_logger(__name__) - - -# pylint: disable=too-few-public-methods -class StorageProfile(Enum): - SAPirImage = 1 - SACustomImage = 2 - SASpecializedOSDisk = 3 - ManagedPirImage = 4 # this would be the main scenarios - ManagedCustomImage = 5 - ManagedSpecializedOSDisk = 6 - SharedGalleryImage = 7 - CommunityGalleryImage = 8 - - -def build_deployment_resource(name, template, dependencies=None): - dependencies = dependencies or [] - deployment = { - 'name': name, - 'type': 'Microsoft.Resources/deployments', - 'apiVersion': '2015-01-01', - 'dependsOn': dependencies, - 'properties': { - 'mode': 'Incremental', - 'template': template, - } - } - return deployment - - -def build_output_deployment_resource(key, property_name, property_provider, property_type, - parent_name=None, output_type='object', path=None): - from azure.cli.core.util import random_string - output_tb = ArmTemplateBuilder() - output_tb.add_output(key, property_name, property_provider, property_type, - output_type=output_type, path=path) - output_template = output_tb.build() - - deployment_name = '{}_{}'.format(property_name, random_string(16)) - deployment = { - 'name': deployment_name, - 'type': 'Microsoft.Resources/deployments', - 'apiVersion': '2015-01-01', - 'properties': { - 'mode': 'Incremental', - 'template': output_template, - } - } - deployment['dependsOn'] = [] if not parent_name \ - else ['Microsoft.Resources/deployments/{}'.format(parent_name)] - - return deployment - - -def build_storage_account_resource(_, name, location, tags, sku, edge_zone=None): - storage_account = { - 'type': 'Microsoft.Storage/storageAccounts', - 'name': name, - 'apiVersion': '2015-06-15', - 'location': location, - 'tags': tags, - 'dependsOn': [], - 'properties': {'accountType': sku} - } - - if edge_zone: - storage_account['apiVersion'] = '2021-04-01' - storage_account['extendedLocation'] = edge_zone - - return storage_account - - -def build_public_ip_resource(cmd, name, location, tags, address_allocation, dns_name, sku, zone, count=None, - edge_zone=None): - public_ip_properties = {'publicIPAllocationMethod': address_allocation} - - if dns_name: - public_ip_properties['dnsSettings'] = {'domainNameLabel': dns_name} - - public_ip = { - 'apiVersion': get_target_network_api(cmd.cli_ctx), - 'type': 'Microsoft.Network/publicIPAddresses', - 'name': name, - 'location': location, - 'tags': tags, - 'dependsOn': [], - 'properties': public_ip_properties - } - - if count: - public_ip['name'] = "[concat('{}', copyIndex())]".format(name) - public_ip['copy'] = { - 'name': 'publicipcopy', - 'mode': 'parallel', - 'count': count - } - - # when multiple zones are provided(through a x-zone scale set), we don't propagate to PIP becasue it doesn't - # support x-zone; rather we will rely on the Standard LB to work with such scale sets - if zone and len(zone) == 1: - public_ip['zones'] = zone - - if sku and cmd.supported_api_version(ResourceType.MGMT_NETWORK, min_api='2017-08-01'): - public_ip['sku'] = {'name': sku} - - # The edge zones are only built out using Standard SKU Public IPs - if edge_zone and sku.lower() == 'standard': - public_ip['apiVersion'] = '2021-02-01' - public_ip['extendedLocation'] = edge_zone - - return public_ip - - -def build_nic_resource(_, name, location, tags, vm_name, subnet_id, private_ip_address=None, - nsg_id=None, public_ip_id=None, application_security_groups=None, accelerated_networking=None, - count=None, edge_zone=None): - private_ip_allocation = 'Static' if private_ip_address else 'Dynamic' - ip_config_properties = { - 'privateIPAllocationMethod': private_ip_allocation, - 'subnet': {'id': subnet_id} - } - - if private_ip_address: - ip_config_properties['privateIPAddress'] = private_ip_address - - if public_ip_id: - ip_config_properties['publicIPAddress'] = {'id': public_ip_id} - if count: - ip_config_properties['publicIPAddress']['id'] = "[concat('{}', copyIndex())]".format(public_ip_id) - - ipconfig_name = 'ipconfig{}'.format(vm_name) - nic_properties = { - 'ipConfigurations': [ - { - 'name': ipconfig_name, - 'properties': ip_config_properties - } - ] - } - if count: - nic_properties['ipConfigurations'][0]['name'] = "[concat('{}', copyIndex())]".format(ipconfig_name) - - if nsg_id: - nic_properties['networkSecurityGroup'] = {'id': nsg_id} - - api_version = '2015-06-15' - if application_security_groups: - asg_ids = [{'id': x['id']} for x in application_security_groups] - nic_properties['ipConfigurations'][0]['properties']['applicationSecurityGroups'] = asg_ids - api_version = '2017-09-01' - - if accelerated_networking is not None: - nic_properties['enableAcceleratedNetworking'] = accelerated_networking - api_version = '2016-09-01' if api_version < '2016-09-01' else api_version - - nic = { - 'apiVersion': api_version, - 'type': 'Microsoft.Network/networkInterfaces', - 'name': name, - 'location': location, - 'tags': tags, - 'dependsOn': [], - 'properties': nic_properties - } - - if count: - nic['name'] = "[concat('{}', copyIndex())]".format(name) - nic['copy'] = { - 'name': 'niccopy', - 'mode': 'parallel', - 'count': count - } - - if edge_zone: - nic['extendedLocation'] = edge_zone - nic['apiVersion'] = '2021-02-01' - - return nic - - -def build_nsg_resource(_, name, location, tags, nsg_rule): - nsg = { - 'type': 'Microsoft.Network/networkSecurityGroups', - 'name': name, - 'apiVersion': '2015-06-15', - 'location': location, - 'tags': tags, - 'dependsOn': [] - } - - if nsg_rule != 'NONE': - rule_name = 'rdp' if nsg_rule == 'RDP' else 'default-allow-ssh' - rule_dest_port = '3389' if nsg_rule == 'RDP' else '22' - - nsg_properties = { - 'securityRules': [ - { - 'name': rule_name, - 'properties': { - 'protocol': 'Tcp', - 'sourcePortRange': '*', - 'destinationPortRange': rule_dest_port, - 'sourceAddressPrefix': '*', - 'destinationAddressPrefix': '*', - 'access': 'Allow', - 'priority': 1000, - 'direction': 'Inbound' - } - } - ] - } - - nsg['properties'] = nsg_properties - - return nsg - - -def build_vnet_resource(_, name, location, tags, vnet_prefix=None, subnet=None, - subnet_prefix=None, dns_servers=None, edge_zone=None): - vnet = { - 'name': name, - 'type': 'Microsoft.Network/virtualNetworks', - 'location': location, - 'apiVersion': '2015-06-15', - 'dependsOn': [], - 'tags': tags, - 'properties': { - 'addressSpace': {'addressPrefixes': [vnet_prefix]}, - } - } - if dns_servers: - vnet['properties']['dhcpOptions'] = { - 'dnsServers': dns_servers - } - if subnet: - vnet['properties']['subnets'] = [{ - 'name': subnet, - 'properties': { - 'addressPrefix': subnet_prefix - } - }] - if edge_zone: - vnet['extendedLocation'] = edge_zone - vnet['apiVersion'] = '2021-02-01' - - return vnet - - -def build_msi_role_assignment(vm_vmss_name, vm_vmss_resource_id, role_definition_id, - role_assignment_guid, identity_scope, is_vm=True): - from azure.mgmt.core.tools import parse_resource_id - result = parse_resource_id(identity_scope) - if result.get('type'): # is a resource id? - name = '{}/Microsoft.Authorization/{}'.format(result['name'], role_assignment_guid) - assignment_type = '{}/{}/providers/roleAssignments'.format(result['namespace'], result['type']) - else: - name = role_assignment_guid - assignment_type = 'Microsoft.Authorization/roleAssignments' - - # pylint: disable=line-too-long - msi_rp_api_version = '2019-07-01' - return { - 'name': name, - 'type': assignment_type, - 'apiVersion': '2015-07-01', # the minimum api-version to create the assignment - 'dependsOn': [ - 'Microsoft.Compute/{}/{}'.format('virtualMachines' if is_vm else 'virtualMachineScaleSets', vm_vmss_name) - ], - 'properties': { - 'roleDefinitionId': role_definition_id, - 'principalId': "[reference('{}', '{}', 'Full').identity.principalId]".format( - vm_vmss_resource_id, msi_rp_api_version), - 'scope': identity_scope - } - } - - -def build_vm_resource( # pylint: disable=too-many-locals, too-many-statements, too-many-branches - cmd, name, location, tags, size, storage_profile, nics, admin_username, - availability_set_id=None, admin_password=None, ssh_key_values=None, ssh_key_path=None, - image_reference=None, os_disk_name=None, custom_image_os_type=None, authentication_type=None, - os_publisher=None, os_offer=None, os_sku=None, os_version=None, os_vhd_uri=None, - attach_os_disk=None, os_disk_size_gb=None, custom_data=None, secrets=None, license_type=None, zone=None, - disk_info=None, boot_diagnostics_storage_uri=None, ultra_ssd_enabled=None, proximity_placement_group=None, - computer_name=None, dedicated_host=None, priority=None, max_price=None, eviction_policy=None, - enable_agent=None, vmss=None, os_disk_encryption_set=None, data_disk_encryption_sets=None, specialized=None, - encryption_at_host=None, dedicated_host_group=None, enable_auto_update=None, patch_mode=None, - enable_hotpatching=None, platform_fault_domain=None, security_type=None, enable_secure_boot=None, - enable_vtpm=None, count=None, edge_zone=None, os_disk_delete_option=None, user_data=None, - capacity_reservation_group=None, enable_hibernation=None, v_cpus_available=None, v_cpus_per_core=None, - os_disk_security_encryption_type=None, os_disk_secure_vm_disk_encryption_set=None, disk_controller_type=None, - enable_proxy_agent=None, proxy_agent_mode=None): - os_caching = disk_info['os'].get('caching') - - def _build_os_profile(): - - special_chars = '`~!@#$%^&*()=+_[]{}\\|;:\'\",<>/?' - - # _computer_name is used to avoid shadow names - _computer_name = computer_name or ''.join(filter(lambda x: x not in special_chars, name)) - - os_profile = { - # Use name as computer_name if it's not provided. Remove special characters from name. - 'computerName': _computer_name, - 'adminUsername': admin_username - } - - if count: - os_profile['computerName'] = "[concat('{}', copyIndex())]".format(_computer_name) - - if admin_password: - os_profile['adminPassword'] = "[parameters('adminPassword')]" - - if custom_data: - os_profile['customData'] = b64encode(custom_data) - - if ssh_key_values and ssh_key_path: - os_profile['linuxConfiguration'] = { - 'disablePasswordAuthentication': authentication_type == 'ssh', - 'ssh': { - 'publicKeys': [ - { - 'keyData': ssh_key_value, - 'path': ssh_key_path - } for ssh_key_value in ssh_key_values - ] - } - } - - if enable_agent is not None: - if custom_image_os_type.lower() == 'linux': - if 'linuxConfiguration' not in os_profile: - os_profile['linuxConfiguration'] = {} - os_profile['linuxConfiguration']['provisionVMAgent'] = enable_agent - elif custom_image_os_type.lower() == 'windows': - if 'windowsConfiguration' not in os_profile: - os_profile['windowsConfiguration'] = {} - os_profile['windowsConfiguration']['provisionVMAgent'] = enable_agent - - if secrets: - os_profile['secrets'] = secrets - - if enable_auto_update is not None and custom_image_os_type.lower() == 'windows': - os_profile['windowsConfiguration']['enableAutomaticUpdates'] = enable_auto_update - - # Windows patch settings - if patch_mode is not None and custom_image_os_type.lower() == 'windows': - if patch_mode.lower() not in ['automaticbyos', 'automaticbyplatform', 'manual']: - raise ValidationError( - 'Invalid value of --patch-mode for Windows VM. Valid values are AutomaticByOS, ' - 'AutomaticByPlatform, Manual.') - os_profile['windowsConfiguration']['patchSettings'] = { - 'patchMode': patch_mode, - 'enableHotpatching': enable_hotpatching - } - - # Linux patch settings - if patch_mode is not None and custom_image_os_type.lower() == 'linux': - if patch_mode.lower() not in ['automaticbyplatform', 'imagedefault']: - raise ValidationError( - 'Invalid value of --patch-mode for Linux VM. Valid values are AutomaticByPlatform, ImageDefault.') - os_profile['linuxConfiguration']['patchSettings'] = { - 'patchMode': patch_mode - } - - return os_profile - - def _build_storage_profile(): - - storage_profiles = { - 'SACustomImage': { - 'osDisk': { - 'createOption': 'fromImage', - 'name': os_disk_name, - 'caching': os_caching, - 'osType': custom_image_os_type, - 'image': {'uri': image_reference}, - 'vhd': {'uri': os_vhd_uri} - } - }, - 'SAPirImage': { - 'osDisk': { - 'createOption': 'fromImage', - 'name': os_disk_name, - 'caching': os_caching, - 'vhd': {'uri': os_vhd_uri} - }, - 'imageReference': { - 'publisher': os_publisher, - 'offer': os_offer, - 'sku': os_sku, - 'version': os_version - } - }, - 'SASpecializedOSDisk': { - 'osDisk': { - 'createOption': 'attach', - 'osType': custom_image_os_type, - 'name': os_disk_name, - 'vhd': {'uri': attach_os_disk} - } - }, - 'ManagedPirImage': { - 'osDisk': { - 'createOption': 'fromImage', - 'name': os_disk_name, - 'caching': os_caching, - 'managedDisk': { - 'storageAccountType': disk_info['os'].get('storageAccountType'), - } - }, - 'imageReference': { - 'publisher': os_publisher, - 'offer': os_offer, - 'sku': os_sku, - 'version': os_version - } - }, - 'ManagedCustomImage': { - 'osDisk': { - 'createOption': 'fromImage', - 'name': os_disk_name, - 'caching': os_caching, - 'managedDisk': { - 'storageAccountType': disk_info['os'].get('storageAccountType'), - } - }, - "imageReference": { - 'id': image_reference - } - }, - 'ManagedSpecializedOSDisk': { - 'osDisk': { - 'createOption': 'attach', - 'osType': custom_image_os_type, - 'managedDisk': { - 'id': attach_os_disk - } - } - }, - 'SharedGalleryImage': { - "osDisk": { - "caching": os_caching, - "managedDisk": { - "storageAccountType": disk_info['os'].get('storageAccountType'), - }, - "name": os_disk_name, - "createOption": "fromImage" - }, - "imageReference": { - 'sharedGalleryImageId': image_reference - } - }, - 'CommunityGalleryImage': { - "osDisk": { - "caching": os_caching, - "managedDisk": { - "storageAccountType": disk_info['os'].get('storageAccountType'), - }, - "name": os_disk_name, - "createOption": "fromImage" - }, - "imageReference": { - 'communityGalleryImageId': image_reference - } - } - } - if os_disk_encryption_set is not None: - storage_profiles['ManagedPirImage']['osDisk']['managedDisk']['diskEncryptionSet'] = { - 'id': os_disk_encryption_set, - } - storage_profiles['ManagedCustomImage']['osDisk']['managedDisk']['diskEncryptionSet'] = { - 'id': os_disk_encryption_set, - } - storage_profiles['SharedGalleryImage']['osDisk']['managedDisk']['diskEncryptionSet'] = { - 'id': os_disk_encryption_set, - } - storage_profiles['CommunityGalleryImage']['osDisk']['managedDisk']['diskEncryptionSet'] = { - 'id': os_disk_encryption_set, - } - if os_disk_security_encryption_type is not None: - storage_profiles['ManagedPirImage']['osDisk']['managedDisk'].update({ - 'securityProfile': { - 'securityEncryptionType': os_disk_security_encryption_type, - } - }) - storage_profiles['ManagedCustomImage']['osDisk']['managedDisk'].update({ - 'securityProfile': { - 'securityEncryptionType': os_disk_security_encryption_type, - } - }) - storage_profiles['SharedGalleryImage']['osDisk']['managedDisk'].update({ - 'securityProfile': { - 'securityEncryptionType': os_disk_security_encryption_type, - } - }) - storage_profiles['CommunityGalleryImage']['osDisk']['managedDisk'].update({ - 'securityProfile': { - 'securityEncryptionType': os_disk_security_encryption_type, - } - }) - if os_disk_secure_vm_disk_encryption_set is not None: - storage_profiles['ManagedPirImage']['osDisk']['managedDisk']['securityProfile'].update({ - 'diskEncryptionSet': { - 'id': os_disk_secure_vm_disk_encryption_set - } - }) - storage_profiles['ManagedCustomImage']['osDisk']['managedDisk']['securityProfile'].update({ - 'diskEncryptionSet': { - 'id': os_disk_secure_vm_disk_encryption_set - } - }) - storage_profiles['SharedGalleryImage']['osDisk']['managedDisk']['securityProfile'].update({ - 'diskEncryptionSet': { - 'id': os_disk_secure_vm_disk_encryption_set - } - }) - storage_profiles['CommunityGalleryImage']['osDisk']['managedDisk']['securityProfile'].update({ - 'diskEncryptionSet': { - 'id': os_disk_secure_vm_disk_encryption_set - } - }) - - profile = storage_profiles[storage_profile.name] - if os_disk_size_gb: - profile['osDisk']['diskSizeGb'] = os_disk_size_gb - if disk_info['os'].get('writeAcceleratorEnabled') is not None: - profile['osDisk']['writeAcceleratorEnabled'] = disk_info['os']['writeAcceleratorEnabled'] - if os_disk_delete_option is not None: - profile['osDisk']['deleteOption'] = os_disk_delete_option - data_disks = [v for k, v in disk_info.items() if k != 'os'] - if data_disk_encryption_sets: - if len(data_disk_encryption_sets) != len(data_disks): - raise CLIError( - 'usage error: Number of --data-disk-encryption-sets mismatches with number of data disks.') - for i, data_disk in enumerate(data_disks): - data_disk['managedDisk']['diskEncryptionSet'] = {'id': data_disk_encryption_sets[i]} - if data_disks: - profile['dataDisks'] = data_disks - - if disk_info['os'].get('diffDiskSettings'): - profile['osDisk']['diffDiskSettings'] = disk_info['os']['diffDiskSettings'] - - if disk_controller_type is not None: - profile['diskControllerType'] = disk_controller_type - - return profile - - vm_properties = {'hardwareProfile': {'vmSize': size}, 'networkProfile': {'networkInterfaces': nics}, - 'storageProfile': _build_storage_profile()} - - vm_size_properties = {} - if v_cpus_available is not None: - vm_size_properties['vCPUsAvailable'] = v_cpus_available - - if v_cpus_per_core is not None: - vm_size_properties['vCPUsPerCore'] = v_cpus_per_core - - if vm_size_properties: - vm_properties['hardwareProfile']['vmSizeProperties'] = vm_size_properties - - if availability_set_id: - vm_properties['availabilitySet'] = {'id': availability_set_id} - - # vmss is ID - if vmss is not None: - vm_properties['virtualMachineScaleSet'] = {'id': vmss} - - if not attach_os_disk and not specialized: - vm_properties['osProfile'] = _build_os_profile() - - if license_type: - vm_properties['licenseType'] = license_type - - if boot_diagnostics_storage_uri: - vm_properties['diagnosticsProfile'] = { - 'bootDiagnostics': { - "enabled": True, - "storageUri": boot_diagnostics_storage_uri - } - } - - if any((ultra_ssd_enabled, enable_hibernation)): - vm_properties['additionalCapabilities'] = {} - if ultra_ssd_enabled is not None: - vm_properties['additionalCapabilities']['ultraSSDEnabled'] = ultra_ssd_enabled - - if enable_hibernation is not None: - vm_properties['additionalCapabilities']['hibernationEnabled'] = enable_hibernation - - if proximity_placement_group: - vm_properties['proximityPlacementGroup'] = {'id': proximity_placement_group} - - if dedicated_host: - vm_properties['host'] = {'id': dedicated_host} - - if dedicated_host_group: - vm_properties['hostGroup'] = {'id': dedicated_host_group} - - if priority is not None: - vm_properties['priority'] = priority - - if eviction_policy is not None: - vm_properties['evictionPolicy'] = eviction_policy - - if max_price is not None: - vm_properties['billingProfile'] = {'maxPrice': max_price} - - vm_properties['securityProfile'] = {} - - if encryption_at_host is not None: - vm_properties['securityProfile']['encryptionAtHost'] = encryption_at_host - - proxy_agent_settings = {} - if enable_proxy_agent is not None: - proxy_agent_settings['enabled'] = enable_proxy_agent - - if proxy_agent_mode is not None: - proxy_agent_settings['mode'] = proxy_agent_mode - - if proxy_agent_settings: - vm_properties['securityProfile']['proxyAgentSettings'] = proxy_agent_settings - - # The `Standard` is used for backward compatibility to allow customers to keep their current behavior - # after changing the default values to Trusted Launch VMs in the future. - from ._constants import COMPATIBLE_SECURITY_TYPE_VALUE - if security_type is not None and security_type != COMPATIBLE_SECURITY_TYPE_VALUE: - vm_properties['securityProfile']['securityType'] = security_type - - if enable_secure_boot is not None or enable_vtpm is not None: - vm_properties['securityProfile']['uefiSettings'] = { - 'secureBootEnabled': enable_secure_boot, - 'vTpmEnabled': enable_vtpm - } - - # Compatibility of various API versions - if vm_properties['securityProfile'] == {}: - del vm_properties['securityProfile'] - - if platform_fault_domain is not None: - vm_properties['platformFaultDomain'] = platform_fault_domain - - if user_data: - vm_properties['userData'] = b64encode(user_data) - - if capacity_reservation_group: - vm_properties['capacityReservation'] = { - 'capacityReservationGroup': { - 'id': capacity_reservation_group - } - } - - vm = { - 'apiVersion': cmd.get_api_version(ResourceType.MGMT_COMPUTE, operation_group='virtual_machines'), - 'type': 'Microsoft.Compute/virtualMachines', - 'name': name, - 'location': location, - 'tags': tags, - 'dependsOn': [], - 'properties': vm_properties, - } - - if zone: - vm['zones'] = zone - - if count: - vm['copy'] = { - 'name': 'vmcopy', - 'mode': 'parallel', - 'count': count - } - vm['name'] = "[concat('{}', copyIndex())]".format(name) - - if edge_zone: - vm['extendedLocation'] = edge_zone - - return vm - - -def _build_frontend_ip_config(name, public_ip_id=None, private_ip_address=None, - private_ip_allocation=None, subnet_id=None): - frontend_ip_config = { - 'name': name - } - - if public_ip_id: - frontend_ip_config.update({ - 'properties': { - 'publicIPAddress': { - 'id': public_ip_id - } - } - }) - else: - frontend_ip_config.update({ - 'properties': { - 'privateIPAllocationMethod': private_ip_allocation, - 'privateIPAddress': private_ip_address, - 'subnet': { - 'id': subnet_id - } - } - }) - return frontend_ip_config - - -def build_application_gateway_resource(_, name, location, tags, backend_pool_name, backend_port, frontend_ip_name, - public_ip_id, subnet_id, gateway_subnet_id, - private_ip_address, private_ip_allocation, sku, capacity): - frontend_ip_config = _build_frontend_ip_config(frontend_ip_name, public_ip_id, - private_ip_address, private_ip_allocation, - subnet_id) - - def _ag_subresource_id(_type, name): - return "[concat(variables('appGwID'), '/{}/{}')]".format(_type, name) - - frontend_ip_config_id = _ag_subresource_id('frontendIPConfigurations', frontend_ip_name) - frontend_port_id = _ag_subresource_id('frontendPorts', 'appGwFrontendPort') - http_listener_id = _ag_subresource_id('httpListeners', 'appGwHttpListener') - backend_address_pool_id = _ag_subresource_id('backendAddressPools', backend_pool_name) - backend_http_settings_id = _ag_subresource_id( - 'backendHttpSettingsCollection', 'appGwBackendHttpSettings') - - ag_properties = { - 'backendAddressPools': [ - { - 'name': backend_pool_name - } - ], - 'backendHttpSettingsCollection': [ - { - 'name': 'appGwBackendHttpSettings', - 'properties': { - 'Port': backend_port, - 'Protocol': 'Http', - 'CookieBasedAffinity': 'Disabled' - } - } - ], - 'frontendIPConfigurations': [frontend_ip_config], - 'frontendPorts': [ - { - 'name': 'appGwFrontendPort', - 'properties': { - 'Port': 80 - } - } - ], - 'gatewayIPConfigurations': [ - { - 'name': 'appGwIpConfig', - 'properties': { - 'subnet': {'id': gateway_subnet_id} - } - } - ], - 'httpListeners': [ - { - 'name': 'appGwHttpListener', - 'properties': { - 'FrontendIPConfiguration': {'Id': frontend_ip_config_id}, - 'FrontendPort': {'Id': frontend_port_id}, - 'Protocol': 'Http', - 'SslCertificate': None - } - } - ], - 'sku': { - 'name': sku, - 'tier': sku.split('_')[0], - 'capacity': capacity - }, - 'requestRoutingRules': [ - { - 'Name': 'rule1', - 'properties': { - 'RuleType': 'Basic', - 'httpListener': {'id': http_listener_id}, - 'backendAddressPool': {'id': backend_address_pool_id}, - 'backendHttpSettings': {'id': backend_http_settings_id} - } - } - ] - } - - ag = { - 'type': 'Microsoft.Network/applicationGateways', - 'name': name, - 'location': location, - 'tags': tags, - 'apiVersion': '2015-06-15', - 'dependsOn': [], - 'properties': ag_properties - } - return ag - - -def build_load_balancer_resource(cmd, name, location, tags, backend_pool_name, nat_pool_name, - backend_port, frontend_ip_name, public_ip_id, subnet_id, private_ip_address, - private_ip_allocation, sku, instance_count, disable_overprovision, edge_zone=None): - lb_id = "resourceId('Microsoft.Network/loadBalancers', '{}')".format(name) - - frontend_ip_config = _build_frontend_ip_config(frontend_ip_name, public_ip_id, - private_ip_address, private_ip_allocation, - subnet_id) - - lb_properties = { - 'backendAddressPools': [ - { - 'name': backend_pool_name - } - ], - 'frontendIPConfigurations': [frontend_ip_config] - } - if nat_pool_name: - lb_properties['inboundNatPools'] = [{ - 'name': nat_pool_name, - 'properties': { - 'frontendIPConfiguration': { - 'id': "[concat({}, '/frontendIPConfigurations/', '{}')]".format( - lb_id, frontend_ip_name) - }, - 'protocol': 'tcp', - 'frontendPortRangeStart': '50000', - # keep 50119 as minimum for backward compat, and ensure over-provision is taken care of - 'frontendPortRangeEnd': str(max(50119, 49999 + instance_count * (1 if disable_overprovision else 2))), - 'backendPort': backend_port - } - }] - - lb = { - 'type': 'Microsoft.Network/loadBalancers', - 'name': name, - 'location': location, - 'tags': tags, - 'apiVersion': get_target_network_api(cmd.cli_ctx), - 'dependsOn': [], - 'properties': lb_properties - } - if sku and cmd.supported_api_version(ResourceType.MGMT_NETWORK, min_api='2017-08-01'): - lb['sku'] = {'name': sku} - # LB rule is the way to enable SNAT so outbound connections are possible - if sku.lower() == 'standard': - lb_properties['loadBalancingRules'] = [{ - "name": "LBRule", - "properties": { - "frontendIPConfiguration": { - 'id': "[concat({}, '/frontendIPConfigurations/', '{}')]".format(lb_id, frontend_ip_name) - }, - "backendAddressPool": { - "id": "[concat({}, '/backendAddressPools/', '{}')]".format(lb_id, backend_pool_name) - }, - "protocol": "tcp", - "frontendPort": 80, - "backendPort": 80, - "enableFloatingIP": False, - "idleTimeoutInMinutes": 5, - } - }] - - if edge_zone: - lb['apiVersion'] = '2021-02-01' - lb['extendedLocation'] = edge_zone - - return lb - - -def build_nat_rule_v2(cmd, name, location, lb_name, frontend_ip_name, backend_pool_name, backend_port, instance_count, - disable_overprovision): - lb_id = "resourceId('Microsoft.Network/loadBalancers', '{}')".format(lb_name) - - nat_rule = { - "type": "Microsoft.Network/loadBalancers/inboundNatRules", - "apiVersion": get_target_network_api(cmd.cli_ctx), - "name": name, - "location": location, - "properties": { - "frontendIPConfiguration": { - 'id': "[concat({}, '/frontendIPConfigurations/', '{}')]".format(lb_id, frontend_ip_name) - }, - "backendAddressPool": { - "id": "[concat({}, '/backendAddressPools/', '{}')]".format(lb_id, backend_pool_name) - }, - "backendPort": backend_port, - "frontendPortRangeStart": "50000", - # This logic comes from the template of `inboundNatPools` to keep consistent with NAT pool - # keep 50119 as minimum for backward compat, and ensure over-provision is taken care of - "frontendPortRangeEnd": str(max(50119, 49999 + instance_count * (1 if disable_overprovision else 2))), - "protocol": "tcp", - "idleTimeoutInMinutes": 5 - }, - "dependsOn": [ - "[concat('Microsoft.Network/loadBalancers/', '{}')]".format(lb_name) - ] - } - - return nat_rule - - -def build_vmss_storage_account_pool_resource(_, loop_name, location, tags, storage_sku, edge_zone=None): - storage_resource = { - 'type': 'Microsoft.Storage/storageAccounts', - 'name': "[variables('storageAccountNames')[copyIndex()]]", - 'location': location, - 'tags': tags, - 'apiVersion': '2015-06-15', - 'copy': { - 'name': loop_name, - 'count': 5 - }, - 'properties': { - 'accountType': storage_sku - } - } - - if edge_zone: - storage_resource['apiVersion'] = '2021-04-01' - storage_resource['extendedLocation'] = edge_zone - - return storage_resource - - -# pylint: disable=too-many-locals, too-many-branches, too-many-statements, too-many-lines -def build_vmss_resource(cmd, name, computer_name_prefix, location, tags, overprovision, upgrade_policy_mode, - vm_sku, instance_count, ip_config_name, nic_name, subnet_id, - public_ip_per_vm, vm_domain_name, dns_servers, nsg, accelerated_networking, - admin_username, authentication_type, storage_profile, os_disk_name, disk_info, - os_type, image=None, admin_password=None, ssh_key_values=None, - ssh_key_path=None, os_publisher=None, os_offer=None, os_sku=None, os_version=None, - backend_address_pool_id=None, inbound_nat_pool_id=None, health_probe=None, - single_placement_group=None, platform_fault_domain_count=None, custom_data=None, - secrets=None, license_type=None, zones=None, priority=None, eviction_policy=None, - application_security_groups=None, ultra_ssd_enabled=None, proximity_placement_group=None, - terminate_notification_time=None, max_price=None, scale_in_policy=None, - os_disk_encryption_set=None, data_disk_encryption_sets=None, - data_disk_iops=None, data_disk_mbps=None, automatic_repairs_grace_period=None, - specialized=None, os_disk_size_gb=None, encryption_at_host=None, host_group=None, - max_batch_instance_percent=None, max_unhealthy_instance_percent=None, - max_unhealthy_upgraded_instance_percent=None, pause_time_between_batches=None, - enable_cross_zone_upgrade=None, prioritize_unhealthy_instances=None, edge_zone=None, - orchestration_mode=None, user_data=None, network_api_version=None, - enable_spot_restore=None, spot_restore_timeout=None, capacity_reservation_group=None, - enable_auto_update=None, patch_mode=None, enable_agent=None, security_type=None, - enable_secure_boot=None, enable_vtpm=None, automatic_repairs_action=None, v_cpus_available=None, - v_cpus_per_core=None, os_disk_security_encryption_type=None, - os_disk_secure_vm_disk_encryption_set=None, os_disk_delete_option=None, - regular_priority_count=None, regular_priority_percentage=None, disk_controller_type=None, - enable_osimage_notification=None, max_surge=None, enable_hibernation=None, - enable_auto_os_upgrade=None, enable_proxy_agent=None, proxy_agent_mode=None, - security_posture_reference_id=None, security_posture_reference_exclude_extensions=None, - enable_resilient_vm_creation=None, enable_resilient_vm_deletion=None, - additional_scheduled_events=None, enable_user_reboot_scheduled_events=None, - enable_user_redeploy_scheduled_events=None, - skuprofile_vmsizes=None, skuprofile_allostrat=None): - # Build IP configuration - ip_configuration = {} - ip_config_properties = {} - - if subnet_id: - ip_config_properties['subnet'] = {'id': subnet_id} - - if public_ip_per_vm: - ip_config_properties['publicipaddressconfiguration'] = { - 'name': 'instancepublicip', - 'properties': { - 'idleTimeoutInMinutes': 10, - } - } - if vm_domain_name: - ip_config_properties['publicipaddressconfiguration']['properties']['dnsSettings'] = { - 'domainNameLabel': vm_domain_name - } - - if backend_address_pool_id: - key = 'loadBalancerBackendAddressPools' if 'loadBalancers' in backend_address_pool_id \ - else 'ApplicationGatewayBackendAddressPools' - ip_config_properties[key] = [ - {'id': backend_address_pool_id} - ] - - if inbound_nat_pool_id: - ip_config_properties['loadBalancerInboundNatPools'] = [ - {'id': inbound_nat_pool_id} - ] - - if application_security_groups and cmd.supported_api_version(min_api='2018-06-01', - operation_group='virtual_machine_scale_sets'): - ip_config_properties['applicationSecurityGroups'] = [{'id': x['id']} for x in application_security_groups] - - if ip_config_properties: - ip_configuration = { - 'name': ip_config_name, - 'properties': ip_config_properties - } - - # Build storage profile - storage_properties = {} - if disk_info: - os_caching = disk_info['os'].get('caching') - - if storage_profile in [StorageProfile.SACustomImage, StorageProfile.SAPirImage]: - storage_properties['osDisk'] = { - 'name': os_disk_name, - 'caching': os_caching, - 'createOption': 'FromImage', - } - - if storage_profile == StorageProfile.SACustomImage: - storage_properties['osDisk'].update({ - 'osType': os_type, - 'image': { - 'uri': image - } - }) - else: - storage_properties['osDisk']['vhdContainers'] = "[variables('vhdContainers')]" - - if os_disk_size_gb is not None: - storage_properties['osDisk']['diskSizeGB'] = os_disk_size_gb - if os_disk_delete_option is not None: - storage_properties['osDisk']['deleteOption'] = os_disk_delete_option - - elif storage_profile in [StorageProfile.ManagedPirImage, StorageProfile.ManagedCustomImage]: - storage_properties['osDisk'] = { - 'createOption': 'FromImage', - 'caching': os_caching, - 'managedDisk': {'storageAccountType': disk_info['os'].get('storageAccountType')} - } - if os_disk_encryption_set is not None: - storage_properties['osDisk']['managedDisk']['diskEncryptionSet'] = { - 'id': os_disk_encryption_set - } - if os_disk_security_encryption_type is not None: - storage_properties['osDisk']['managedDisk'].update({ - 'securityProfile': { - 'securityEncryptionType': os_disk_security_encryption_type - } - }) - if os_disk_secure_vm_disk_encryption_set is not None: - storage_properties['osDisk']['managedDisk']['securityProfile'].update({ - 'diskEncryptionSet': { - 'id': os_disk_secure_vm_disk_encryption_set - } - }) - if disk_info and disk_info['os'].get('diffDiskSettings'): - storage_properties['osDisk']['diffDiskSettings'] = disk_info['os']['diffDiskSettings'] - - if os_disk_size_gb is not None: - storage_properties['osDisk']['diskSizeGB'] = os_disk_size_gb - if os_disk_delete_option is not None: - storage_properties['osDisk']['deleteOption'] = os_disk_delete_option - - if storage_profile in [StorageProfile.SAPirImage, StorageProfile.ManagedPirImage]: - storage_properties['imageReference'] = { - 'publisher': os_publisher, - 'offer': os_offer, - 'sku': os_sku, - 'version': os_version - } - if storage_profile == StorageProfile.ManagedCustomImage: - storage_properties['imageReference'] = { - 'id': image - } - if storage_profile == StorageProfile.SharedGalleryImage: - storage_properties['osDisk'] = { - 'caching': os_caching, - 'managedDisk': {'storageAccountType': disk_info['os'].get('storageAccountType')}, - "name": os_disk_name, - "createOption": "fromImage" - } - storage_properties['imageReference'] = { - 'sharedGalleryImageId': image - } - if os_disk_encryption_set is not None: - storage_properties['osDisk']['managedDisk']['diskEncryptionSet'] = { - 'id': os_disk_encryption_set - } - if os_disk_security_encryption_type is not None: - storage_properties['osDisk']['managedDisk'].update({ - 'securityProfile': { - 'securityEncryptionType': os_disk_security_encryption_type, - } - }) - if os_disk_secure_vm_disk_encryption_set is not None: - storage_properties['osDisk']['managedDisk']['securityProfile'].update({ - 'diskEncryptionSet': { - 'id': os_disk_secure_vm_disk_encryption_set - } - }) - if os_disk_delete_option is not None: - storage_properties['osDisk']['deleteOption'] = os_disk_delete_option - if storage_profile == StorageProfile.CommunityGalleryImage: - storage_properties['osDisk'] = { - 'caching': os_caching, - 'managedDisk': {'storageAccountType': disk_info['os'].get('storageAccountType')}, - "name": os_disk_name, - "createOption": "fromImage" - } - storage_properties['imageReference'] = { - 'communityGalleryImageId': image - } - if os_disk_encryption_set is not None: - storage_properties['osDisk']['managedDisk']['diskEncryptionSet'] = { - 'id': os_disk_encryption_set - } - if os_disk_security_encryption_type is not None: - storage_properties['osDisk']['managedDisk'].update({ - 'securityProfile': { - 'securityEncryptionType': os_disk_security_encryption_type, - } - }) - if os_disk_secure_vm_disk_encryption_set is not None: - storage_properties['osDisk']['managedDisk']['securityProfile'].update({ - 'diskEncryptionSet': { - 'id': os_disk_secure_vm_disk_encryption_set - } - }) - if os_disk_delete_option is not None: - storage_properties['osDisk']['deleteOption'] = os_disk_delete_option - - if disk_info: - data_disks = [v for k, v in disk_info.items() if k != 'os'] - else: - data_disks = [] - - if data_disk_encryption_sets: - if len(data_disk_encryption_sets) != len(data_disks): - raise CLIError( - 'usage error: Number of --data-disk-encryption-sets mismatches with number of data disks.') - for i, data_disk in enumerate(data_disks): - data_disk['managedDisk']['diskEncryptionSet'] = {'id': data_disk_encryption_sets[i]} - if data_disk_iops: - if len(data_disk_iops) != len(data_disks): - raise CLIError('usage error: Number of --data-disk-iops mismatches with number of data disks.') - for i, data_disk in enumerate(data_disks): - data_disk['diskIOPSReadWrite'] = data_disk_iops[i] - if data_disk_mbps: - if len(data_disk_mbps) != len(data_disks): - raise CLIError('usage error: Number of --data-disk-mbps mismatches with number of data disks.') - for i, data_disk in enumerate(data_disks): - data_disk['diskMBpsReadWrite'] = data_disk_mbps[i] - if data_disks: - storage_properties['dataDisks'] = data_disks - if disk_controller_type is not None: - storage_properties['diskControllerType'] = disk_controller_type - - # Build OS Profile - os_profile = {} - if computer_name_prefix: - os_profile['computerNamePrefix'] = computer_name_prefix - - if admin_username: - os_profile['adminUsername'] = admin_username - - if admin_password: - os_profile['adminPassword'] = "[parameters('adminPassword')]" - - if ssh_key_values and ssh_key_path: - os_profile['linuxConfiguration'] = { - 'disablePasswordAuthentication': authentication_type == 'ssh', - 'ssh': { - 'publicKeys': [ - { - 'path': ssh_key_path, - 'keyData': ssh_key_value - } for ssh_key_value in ssh_key_values - ] - } - } - - if custom_data: - os_profile['customData'] = b64encode(custom_data) - - if secrets: - os_profile['secrets'] = secrets - - if enable_agent is not None: - if os_type.lower() == 'linux': - if 'linuxConfiguration' not in os_profile: - os_profile['linuxConfiguration'] = {} - os_profile['linuxConfiguration']['provisionVMAgent'] = enable_agent - elif os_type.lower() == 'windows': - if 'windowsConfiguration' not in os_profile: - os_profile['windowsConfiguration'] = {} - os_profile['windowsConfiguration']['provisionVMAgent'] = enable_agent - - if enable_auto_update is not None and os_type.lower() == 'windows': - os_profile['windowsConfiguration']['enableAutomaticUpdates'] = enable_auto_update - - # Windows patch settings - if patch_mode is not None and os_type.lower() == 'windows': - if patch_mode.lower() not in ['automaticbyos', 'automaticbyplatform', 'manual']: - raise InvalidArgumentValueError( - 'Invalid value of --patch-mode for Windows VMSS. Valid values are AutomaticByOS, ' - 'AutomaticByPlatform, Manual.') - os_profile['windowsConfiguration']['patchSettings'] = { - 'patchMode': patch_mode - } - - # Linux patch settings - if patch_mode is not None and os_type.lower() == 'linux': - if patch_mode.lower() not in ['automaticbyplatform', 'imagedefault']: - raise InvalidArgumentValueError( - 'Invalid value of --patch-mode for Linux VMSS. Valid values are AutomaticByPlatform, ImageDefault.') - os_profile['linuxConfiguration']['patchSettings'] = { - 'patchMode': patch_mode - } - - # Build VMSS - nic_config = {} - nic_config_properties = {} - - if ip_configuration: - nic_config_properties['ipConfigurations'] = [ip_configuration] - - if cmd.supported_api_version(min_api='2017-03-30', operation_group='virtual_machine_scale_sets'): - if dns_servers: - nic_config_properties['dnsSettings'] = {'dnsServers': dns_servers} - - if accelerated_networking: - nic_config_properties['enableAcceleratedNetworking'] = True - - if nsg: - nic_config_properties['networkSecurityGroup'] = {'id': nsg} - - if nic_config_properties: - nic_config_properties['primary'] = 'true' - nic_config = { - 'name': nic_name, - 'properties': nic_config_properties - } - - vmss_properties = {} - network_profile = {} - virtual_machine_profile = {} - if nic_config: - network_profile['networkInterfaceConfigurations'] = [nic_config] - - if overprovision is not None: - vmss_properties['overprovision'] = overprovision - - if storage_properties: - virtual_machine_profile['storageProfile'] = storage_properties - - hardware_profile = {} - vm_size_properties = {} - if v_cpus_available is not None: - vm_size_properties['vCPUsAvailable'] = v_cpus_available - - if v_cpus_per_core is not None: - vm_size_properties['vCPUsPerCore'] = v_cpus_per_core - - if vm_size_properties: - hardware_profile['vmSizeProperties'] = vm_size_properties - - if hardware_profile: - virtual_machine_profile['hardwareProfile'] = hardware_profile - - if not specialized and os_profile: - virtual_machine_profile['osProfile'] = os_profile - - if upgrade_policy_mode: - vmss_properties['upgradePolicy'] = { - 'mode': upgrade_policy_mode - } - if upgrade_policy_mode and cmd.supported_api_version(min_api='2020-12-01', - operation_group='virtual_machine_scale_sets'): - rolling_upgrade_policy = {} - if max_batch_instance_percent is not None: - rolling_upgrade_policy['maxBatchInstancePercent'] = max_batch_instance_percent - - if max_unhealthy_instance_percent is not None: - rolling_upgrade_policy['maxUnhealthyInstancePercent'] = max_unhealthy_instance_percent - - if max_unhealthy_upgraded_instance_percent is not None: - rolling_upgrade_policy['maxUnhealthyUpgradedInstancePercent'] = max_unhealthy_upgraded_instance_percent - - if pause_time_between_batches is not None: - rolling_upgrade_policy['pauseTimeBetweenBatches'] = pause_time_between_batches - - if enable_cross_zone_upgrade is not None: - rolling_upgrade_policy['enableCrossZoneUpgrade'] = enable_cross_zone_upgrade - - if prioritize_unhealthy_instances is not None: - rolling_upgrade_policy['prioritizeUnhealthyInstances'] = prioritize_unhealthy_instances - - if max_surge is not None: - rolling_upgrade_policy['maxSurge'] = max_surge - - if rolling_upgrade_policy: - vmss_properties['upgradePolicy']['rollingUpgradePolicy'] = rolling_upgrade_policy - - if upgrade_policy_mode and cmd.supported_api_version(min_api='2018-10-01', - operation_group='virtual_machine_scale_sets'): - automatic_os_upgrade_policy = {} - if enable_auto_os_upgrade is not None: - automatic_os_upgrade_policy['enableAutomaticOSUpgrade'] = enable_auto_os_upgrade - - if automatic_os_upgrade_policy: - vmss_properties['upgradePolicy']['automaticOSUpgradePolicy'] = automatic_os_upgrade_policy - - if upgrade_policy_mode and upgrade_policy_mode.lower() == 'rolling' and \ - cmd.supported_api_version(min_api='2020-12-01', operation_group='virtual_machine_scale_sets'): - if os_type.lower() == 'linux': - from azure.cli.command_modules.vm._vmss_application_health import application_health_setting_for_linux - application_health_data = application_health_setting_for_linux - health_extension_name = 'ApplicationHealthLinux' - else: - from azure.cli.command_modules.vm._vmss_application_health import application_health_setting_for_windows - application_health_data = application_health_setting_for_windows - health_extension_name = 'ApplicationHealthWindows' - health_extension = [{ - "name": health_extension_name, - "properties": { - "publisher": "Microsoft.ManagedServices", - "type": health_extension_name, - "typeHandlerVersion": "1.0", - "autoUpgradeMinorVersion": True, - "settings": { - "port": 80, - "protocol": "http", - "requestPath": "/" - } - } - }] - virtual_machine_profile['extensionProfile'] = { - 'extensions': health_extension - } - os_profile['customData'] = b64encode(application_health_data) - - if enable_spot_restore and cmd.supported_api_version(min_api='2021-04-01', - operation_group='virtual_machine_scale_sets'): - vmss_properties['spotRestorePolicy'] = {} - if enable_spot_restore: - vmss_properties['spotRestorePolicy']['enabled'] = enable_spot_restore - - if spot_restore_timeout: - vmss_properties['spotRestorePolicy']['restoreTimeout'] = spot_restore_timeout - - if regular_priority_count is not None or regular_priority_percentage is not None: - priority_mix_policy = {} - if regular_priority_count is not None: - priority_mix_policy['baseRegularPriorityCount'] = regular_priority_count - if regular_priority_percentage is not None: - priority_mix_policy['regularPriorityPercentageAboveBase'] = regular_priority_percentage - vmss_properties['priorityMixPolicy'] = priority_mix_policy - - if license_type: - virtual_machine_profile['licenseType'] = license_type - - if health_probe and cmd.supported_api_version(min_api='2017-03-30', operation_group='virtual_machine_scale_sets'): - network_profile['healthProbe'] = {'id': health_probe} - - if network_api_version and \ - cmd.supported_api_version(min_api='2021-03-01', operation_group='virtual_machine_scale_sets'): - network_profile['networkApiVersion'] = network_api_version - - if cmd.supported_api_version(min_api='2016-04-30-preview', operation_group='virtual_machine_scale_sets'): - vmss_properties['singlePlacementGroup'] = single_placement_group - - if priority and cmd.supported_api_version(min_api='2017-12-01', operation_group='virtual_machine_scale_sets'): - virtual_machine_profile['priority'] = priority - - if eviction_policy and cmd.supported_api_version(min_api='2017-12-01', - operation_group='virtual_machine_scale_sets'): - virtual_machine_profile['evictionPolicy'] = eviction_policy - - if max_price is not None and cmd.supported_api_version( - min_api='2019-03-01', operation_group='virtual_machine_scale_sets'): - virtual_machine_profile['billingProfile'] = {'maxPrice': max_price} - - if platform_fault_domain_count is not None and cmd.supported_api_version( - min_api='2017-12-01', operation_group='virtual_machine_scale_sets'): - vmss_properties['platformFaultDomainCount'] = platform_fault_domain_count - - if ultra_ssd_enabled is not None: - if cmd.supported_api_version(min_api='2019-03-01', operation_group='virtual_machine_scale_sets'): - vmss_properties['additionalCapabilities'] = {'ultraSSDEnabled': ultra_ssd_enabled} - else: - virtual_machine_profile['additionalCapabilities'] = {'ultraSSDEnabled': ultra_ssd_enabled} - - if proximity_placement_group: - vmss_properties['proximityPlacementGroup'] = {'id': proximity_placement_group} - - scheduled_events_profile = {} - if terminate_notification_time is not None: - scheduled_events_profile.update({ - 'terminateNotificationProfile': { - 'notBeforeTimeout': terminate_notification_time, - 'enable': 'true' - } - }) - virtual_machine_profile['scheduledEventsProfile'] = scheduled_events_profile - - if enable_osimage_notification is not None: - scheduled_events_profile.update({ - 'osImageNotificationProfile': { - 'enable': enable_osimage_notification - } - }) - virtual_machine_profile['scheduledEventsProfile'] = scheduled_events_profile - - scheduled_events_policy = {} - if additional_scheduled_events is not None: - scheduled_events_policy.update({ - "scheduledEventsAdditionalPublishingTargets": { - "eventGridAndResourceGraph": { - "enable": additional_scheduled_events - } - } - }) - if enable_user_redeploy_scheduled_events is not None: - scheduled_events_policy.update({ - "userInitiatedRedeploy": { - "automaticallyApprove": enable_user_redeploy_scheduled_events - } - }) - if enable_user_reboot_scheduled_events is not None: - scheduled_events_policy.update({ - "userInitiatedReboot": { - "automaticallyApprove": enable_user_reboot_scheduled_events - } - }) - if scheduled_events_policy: - vmss_properties['scheduledEventsPolicy'] = scheduled_events_policy - - if automatic_repairs_grace_period is not None or automatic_repairs_action is not None: - automatic_repairs_policy = { - 'enabled': 'true', - 'gracePeriod': automatic_repairs_grace_period or 'PT10M', - 'repairAction': automatic_repairs_action or 'Replace' - } - vmss_properties['automaticRepairsPolicy'] = automatic_repairs_policy - - if scale_in_policy: - vmss_properties['scaleInPolicy'] = {'rules': scale_in_policy} - - if enable_resilient_vm_creation is not None or enable_resilient_vm_deletion is not None: - resiliency_policy = {} - if enable_resilient_vm_creation is not None: - resiliency_policy['resilientVMCreationPolicy'] = {'enabled': enable_resilient_vm_creation} - if enable_resilient_vm_deletion is not None: - resiliency_policy['resilientVMDeletionPolicy'] = {'enabled': enable_resilient_vm_deletion} - vmss_properties['resiliencyPolicy'] = resiliency_policy - - security_profile = {} - if encryption_at_host: - security_profile['encryptionAtHost'] = encryption_at_host - - # The `Standard` is used for backward compatibility to allow customers to keep their current behavior - # after changing the default values to Trusted Launch VMs in the future. - from ._constants import COMPATIBLE_SECURITY_TYPE_VALUE - if security_type is not None and security_type != COMPATIBLE_SECURITY_TYPE_VALUE: - security_profile['securityType'] = security_type - - if enable_secure_boot is not None or enable_vtpm is not None: - security_profile['uefiSettings'] = { - 'secureBootEnabled': enable_secure_boot, - 'vTpmEnabled': enable_vtpm - } - - proxy_agent_settings = {} - if enable_proxy_agent is not None: - proxy_agent_settings['enabled'] = enable_proxy_agent - - if proxy_agent_mode is not None: - proxy_agent_settings['mode'] = proxy_agent_mode - - if proxy_agent_settings: - security_profile['proxyAgentSettings'] = proxy_agent_settings - - if security_profile: - virtual_machine_profile['securityProfile'] = security_profile - - if user_data: - virtual_machine_profile['userData'] = b64encode(user_data) - - if host_group: - vmss_properties['hostGroup'] = {'id': host_group} - - if network_profile: - virtual_machine_profile['networkProfile'] = network_profile - - if capacity_reservation_group: - virtual_machine_profile['capacityReservation'] = { - 'capacityReservationGroup': { - 'id': capacity_reservation_group - } - } - - if security_posture_reference_id: - virtual_machine_profile['securityPostureReference'] = { - 'id': security_posture_reference_id, - } - - if security_posture_reference_exclude_extensions: - security_posture_reference = virtual_machine_profile.get('securityPostureReference', {}) - security_posture_reference['excludeExtensions'] = security_posture_reference_exclude_extensions - virtual_machine_profile['securityPostureReference'] = security_posture_reference - - if virtual_machine_profile: - vmss_properties['virtualMachineProfile'] = virtual_machine_profile - - if orchestration_mode and cmd.supported_api_version(min_api='2020-06-01', - operation_group='virtual_machine_scale_sets'): - vmss_properties['orchestrationMode'] = orchestration_mode - - if enable_hibernation is not None: - if not vmss_properties.get('additionalCapabilities'): - vmss_properties['additionalCapabilities'] = {} - vmss_properties['additionalCapabilities']['hibernationEnabled'] = enable_hibernation - - if skuprofile_vmsizes: - sku_profile_vmsizes_list = [] - for vm_size in skuprofile_vmsizes: - vmsize_obj = { - 'name': vm_size - } - sku_profile_vmsizes_list.append(vmsize_obj) - sku_profile = { - 'vmSizes': sku_profile_vmsizes_list, - 'allocationStrategy': skuprofile_allostrat - } - vmss_properties['skuProfile'] = sku_profile - - vmss = { - 'type': 'Microsoft.Compute/virtualMachineScaleSets', - 'name': name, - 'location': location, - 'tags': tags, - 'apiVersion': cmd.get_api_version(ResourceType.MGMT_COMPUTE, operation_group='virtual_machine_scale_sets'), - 'dependsOn': [], - 'properties': vmss_properties - } - - if vm_sku: - vmss['sku'] = { - 'name': vm_sku, - 'capacity': instance_count - } - - if vmss_properties: - vmss['properties'] = vmss_properties - - if zones: - vmss['zones'] = zones - - if edge_zone: - vmss['extendedLocation'] = edge_zone - - return vmss - - -def build_av_set_resource(cmd, name, location, tags, platform_update_domain_count, - platform_fault_domain_count, unmanaged, proximity_placement_group=None): - av_set = { - 'type': 'Microsoft.Compute/availabilitySets', - 'name': name, - 'location': location, - 'tags': tags, - 'apiVersion': cmd.get_api_version(ResourceType.MGMT_COMPUTE, operation_group='availability_sets'), - "properties": { - 'platformFaultDomainCount': platform_fault_domain_count, - } - } - - if cmd.supported_api_version(min_api='2016-04-30-preview', operation_group='availability_sets'): - av_set['sku'] = { - 'name': 'Classic' if unmanaged else 'Aligned' - } - - # server defaults the UD to 5 unless set otherwise - if platform_update_domain_count is not None: - av_set['properties']['platformUpdateDomainCount'] = platform_update_domain_count - - if proximity_placement_group: - av_set['properties']['proximityPlacementGroup'] = {'id': proximity_placement_group} - - return av_set - - -def build_vm_linux_log_analytics_workspace_agent(_, vm_name, location): - ''' - This is used for log analytics workspace - ''' - mmaExtension_resource = { - 'type': 'Microsoft.Compute/virtualMachines/extensions', - 'apiVersion': '2018-10-01', - 'properties': { - 'publisher': 'Microsoft.EnterpriseCloud.Monitoring', - 'type': 'OmsAgentForLinux', - 'typeHandlerVersion': '1.0', - 'autoUpgradeMinorVersion': 'true', - 'settings': { - 'workspaceId': "[reference(parameters('workspaceId'), '2015-11-01-preview').customerId]", - 'stopOnMultipleConnections': 'true' - }, - 'protectedSettings': { - 'workspaceKey': "[listKeys(parameters('workspaceId'), '2015-11-01-preview').primarySharedKey]" - } - } - } - - mmaExtension_resource['name'] = vm_name + '/OmsAgentForLinux' - mmaExtension_resource['location'] = location - mmaExtension_resource['dependsOn'] = ['Microsoft.Compute/virtualMachines/' + vm_name] - return mmaExtension_resource - - -def build_vm_windows_log_analytics_workspace_agent(_, vm_name, location): - ''' - This function is used for log analytics workspace. - ''' - mmaExtension_resource = { - 'type': 'Microsoft.Compute/virtualMachines/extensions', - 'apiVersion': '2018-10-01', - 'properties': { - 'publisher': 'Microsoft.EnterpriseCloud.Monitoring', - 'type': 'MicrosoftMonitoringAgent', - 'typeHandlerVersion': '1.0', - 'autoUpgradeMinorVersion': 'true', - 'settings': { - 'workspaceId': "[reference(parameters('workspaceId'), '2015-11-01-preview').customerId]", - 'stopOnMultipleConnections': 'true' - }, - 'protectedSettings': { - 'workspaceKey': "[listKeys(parameters('workspaceId'), '2015-11-01-preview').primarySharedKey]" - } - } - } - - mmaExtension_resource['name'] = vm_name + '/MicrosoftMonitoringAgent' - mmaExtension_resource['location'] = location - mmaExtension_resource['dependsOn'] = ['Microsoft.Compute/virtualMachines/' + vm_name] - return mmaExtension_resource diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_validators.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_validators.py deleted file mode 100644 index b6bc4121e89..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_validators.py +++ /dev/null @@ -1,2548 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# pylint:disable=too-many-lines - -import os - -from urllib.parse import urlparse - -from knack.log import get_logger -from knack.util import CLIError - -from azure.cli.core.azclierror import (ValidationError, ArgumentUsageError, RequiredArgumentMissingError, - MutuallyExclusiveArgumentError, CLIInternalError) -from azure.cli.core.commands.validators import ( - get_default_location_from_resource_group, validate_file_or_dict, validate_parameter_set, validate_tags) -from azure.cli.core.util import (hash_string, DISALLOWED_USER_NAMES, get_default_admin_username) -from azure.cli.command_modules.vm.azure_stack._vm_utils import (check_existence, get_storage_blob_uri, list_sku_info, - import_aaz_by_profile) -from azure.cli.command_modules.vm.azure_stack._template_builder import StorageProfile -from azure.cli.core import keys -from azure.core.exceptions import ResourceNotFoundError - -from ._client_factory import _compute_client_factory -from ._actions import _get_latest_image_version - -logger = get_logger(__name__) - - -def validate_asg_names_or_ids(cmd, namespace): - from azure.mgmt.core.tools import is_valid_resource_id, resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - - resource_group = namespace.resource_group_name - subscription_id = get_subscription_id(cmd.cli_ctx) - names_or_ids = getattr(namespace, 'application_security_groups') - ids = [] - - if names_or_ids == [""] or not names_or_ids: - return - - for val in names_or_ids: - if not is_valid_resource_id(val): - val = resource_id( - subscription=subscription_id, - resource_group=resource_group, - namespace='Microsoft.Network', type='applicationSecurityGroups', - name=val - ) - ids.append({'id': val}) - setattr(namespace, 'application_security_groups', ids) - - -def validate_nsg_name(cmd, namespace): - from azure.mgmt.core.tools import resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - vm_id = resource_id(name=namespace.vm_name, resource_group=namespace.resource_group_name, - namespace='Microsoft.Compute', type='virtualMachines', - subscription=get_subscription_id(cmd.cli_ctx)) - namespace.network_security_group_name = namespace.network_security_group_name \ - or '{}_NSG_{}'.format(namespace.vm_name, hash_string(vm_id, length=8)) - - -def validate_keyvault(cmd, namespace): - namespace.keyvault = _get_resource_id(cmd.cli_ctx, namespace.keyvault, namespace.resource_group_name, - 'vaults', 'Microsoft.KeyVault') - - -def validate_vm_name_for_monitor_metrics(cmd, namespace): - if hasattr(namespace, 'resource'): - namespace.resource = _get_resource_id(cmd.cli_ctx, namespace.resource, namespace.resource_group_name, - 'virtualMachines', 'Microsoft.Compute') - elif hasattr(namespace, 'resource_uri'): - namespace.resource_uri = _get_resource_id(cmd.cli_ctx, namespace.resource_uri, namespace.resource_group_name, - 'virtualMachines', 'Microsoft.Compute') - del namespace.resource_group_name - - -def _validate_proximity_placement_group(cmd, namespace): - from azure.mgmt.core.tools import parse_resource_id - - if namespace.proximity_placement_group: - namespace.proximity_placement_group = _get_resource_id(cmd.cli_ctx, namespace.proximity_placement_group, - namespace.resource_group_name, - 'proximityPlacementGroups', 'Microsoft.Compute') - - parsed = parse_resource_id(namespace.proximity_placement_group) - rg, name = parsed['resource_group'], parsed['name'] - - if not check_existence(cmd.cli_ctx, name, rg, 'Microsoft.Compute', 'proximityPlacementGroups'): - raise CLIError("Proximity Placement Group '{}' does not exist.".format(name)) - - -def process_vm_secret_format(cmd, namespace): - from azure.mgmt.core.tools import is_valid_resource_id - from azure.cli.core._output import (get_output_format, set_output_format) - - keyvault_usage = CLIError('usage error: [--keyvault NAME --resource-group NAME | --keyvault ID]') - kv = namespace.keyvault - rg = namespace.resource_group_name - - if rg: - if not kv or is_valid_resource_id(kv): - raise keyvault_usage - validate_keyvault(cmd, namespace) - else: - if kv and not is_valid_resource_id(kv): - raise keyvault_usage - - warning_msg = "This command does not support the {} output format. Showing JSON format instead." - desired_formats = ["json", "jsonc"] - - output_format = get_output_format(cmd.cli_ctx) - if output_format not in desired_formats: - warning_msg = warning_msg.format(output_format) - logger.warning(warning_msg) - set_output_format(cmd.cli_ctx, desired_formats[0]) - - -def _get_resource_group_from_vault_name(cli_ctx, vault_name): - """ - Fetch resource group from vault name - :param str vault_name: name of the key vault - :return: resource group name or None - :rtype: str - """ - from azure.cli.core.profiles import ResourceType - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.mgmt.core.tools import parse_resource_id - client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_KEYVAULT).vaults - for vault in client.list(): - id_comps = parse_resource_id(vault.id) - if id_comps['name'] == vault_name: - return id_comps['resource_group'] - return None - - -def _get_resource_id(cli_ctx, val, resource_group, resource_type, resource_namespace): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - if is_valid_resource_id(val): - return val - - kwargs = { - 'name': val, - 'resource_group': resource_group, - 'namespace': resource_namespace, - 'type': resource_type, - 'subscription': get_subscription_id(cli_ctx) - } - missing_kwargs = {k: v for k, v in kwargs.items() if not v} - - return resource_id(**kwargs) if not missing_kwargs else None - - -def _get_nic_id(cli_ctx, val, resource_group): - return _get_resource_id(cli_ctx, val, resource_group, - 'networkInterfaces', 'Microsoft.Network') - - -def validate_vm_nic(cmd, namespace): - namespace.nic = _get_nic_id(cmd.cli_ctx, namespace.nic, namespace.resource_group_name) - - -def validate_vm_nics(cmd, namespace): - rg = namespace.resource_group_name - nic_ids = [] - - for n in namespace.nics: - nic_ids.append(_get_nic_id(cmd.cli_ctx, n, rg)) - namespace.nics = nic_ids - - if hasattr(namespace, 'primary_nic') and namespace.primary_nic: - namespace.primary_nic = _get_nic_id(cmd.cli_ctx, namespace.primary_nic, rg) - - -def _validate_secrets(secrets, os_type): - """ - Validates a parsed JSON array containing secrets for use in VM Creation - Secrets JSON structure - [{ - "sourceVault": { "id": "value" }, - "vaultCertificates": [{ - "certificateUrl": "value", - "certificateStore": "cert store name (only on windows)" - }] - }] - :param dict secrets: Dict fitting the JSON description above - :param string os_type: the type of OS (linux or windows) - :return: errors if any were found - :rtype: list - """ - is_windows = os_type == 'windows' - errors = [] - - try: - loaded_secret = [validate_file_or_dict(secret) for secret in secrets] - except Exception as err: - raise CLIError('Error decoding secrets: {0}'.format(err)) - - for idx_arg, narg_secret in enumerate(loaded_secret): - for idx, secret in enumerate(narg_secret): - if 'sourceVault' not in secret: - errors.append( - 'Secret is missing sourceVault key at index {0} in arg {1}'.format( - idx, idx_arg)) - if 'sourceVault' in secret and 'id' not in secret['sourceVault']: - errors.append( - 'Secret is missing sourceVault.id key at index {0} in arg {1}'.format( - idx, idx_arg)) - if 'vaultCertificates' not in secret or not secret['vaultCertificates']: - err = 'Secret is missing vaultCertificates array or it is empty at index {0} in ' \ - 'arg {1} ' - errors.append(err.format(idx, idx_arg)) - else: - for jdx, cert in enumerate(secret['vaultCertificates']): - message = 'Secret is missing {0} within vaultCertificates array at secret ' \ - 'index {1} and vaultCertificate index {2} in arg {3}' - if 'certificateUrl' not in cert: - errors.append(message.format('certificateUrl', idx, jdx, idx_arg)) - if is_windows and 'certificateStore' not in cert: - errors.append(message.format('certificateStore', idx, jdx, idx_arg)) - - if errors: - raise CLIError('\n'.join(errors)) - - -# region VM Create Validators - - -# pylint: disable=too-many-return-statements -def _parse_image_argument(cmd, namespace): - """ Systematically determines what type is supplied for the --image parameter. Updates the - namespace and returns the type for subsequent processing. """ - from azure.mgmt.core.tools import is_valid_resource_id - from azure.core.exceptions import HttpResponseError - import re - - # 1 - check if a fully-qualified ID (assumes it is an image ID) - if is_valid_resource_id(namespace.image): - return 'image_id' - - from ._vm_utils import is_shared_gallery_image_id, is_community_gallery_image_id - if is_shared_gallery_image_id(namespace.image): - return 'shared_gallery_image_id' - - if is_community_gallery_image_id(namespace.image): - return 'community_gallery_image_id' - - # 2 - attempt to match an URN pattern - urn_match = re.match('([^:]*):([^:]*):([^:]*):([^:]*)', namespace.image) - if urn_match: - namespace.os_publisher = urn_match.group(1) - namespace.os_offer = urn_match.group(2) - namespace.os_sku = urn_match.group(3) - namespace.os_version = urn_match.group(4) - - if not any([namespace.plan_name, namespace.plan_product, namespace.plan_publisher]): - image_plan = _get_image_plan_info_if_exists(cmd, namespace) - if image_plan: - namespace.plan_name = image_plan.name - namespace.plan_product = image_plan.product - namespace.plan_publisher = image_plan.publisher - - return 'urn' - - # 3 - unmanaged vhd based images? - if urlparse(namespace.image).scheme and "://" in namespace.image: - return 'uri' - - # 4 - attempt to match an URN alias (most likely) - from azure.cli.command_modules.vm.azure_stack._actions import load_images_from_aliases_doc - import requests - try: - images = None - images = load_images_from_aliases_doc(cmd.cli_ctx) - matched = next((x for x in images if x['urnAlias'].lower() == namespace.image.lower()), None) - if matched: - namespace.os_publisher = matched['publisher'] - namespace.os_offer = matched['offer'] - namespace.os_sku = matched['sku'] - namespace.os_version = matched['version'] - if not any([namespace.plan_name, namespace.plan_product, namespace.plan_publisher]): - image_plan = _get_image_plan_info_if_exists(cmd, namespace) - if image_plan: - namespace.plan_name = image_plan.name - namespace.plan_product = image_plan.product - namespace.plan_publisher = image_plan.publisher - return 'urn' - except requests.exceptions.ConnectionError: - pass - - # 5 - check if an existing managed disk image resource - compute_client = _compute_client_factory(cmd.cli_ctx) - try: - compute_client.images.get(namespace.resource_group_name, namespace.image) - namespace.image = _get_resource_id(cmd.cli_ctx, namespace.image, namespace.resource_group_name, - 'images', 'Microsoft.Compute') - return 'image_id' - except HttpResponseError: - if images is not None: - err = 'Invalid image "{}". Use a valid image URN, custom image name, custom image id, ' \ - 'VHD blob URI, or pick an image from {}.\nSee vm create -h for more information ' \ - 'on specifying an image.'.format(namespace.image, [x['urnAlias'] for x in images]) - else: - err = 'Failed to connect to remote source of image aliases or find a local copy. Invalid image "{}". ' \ - 'Use a valid image URN, custom image name, custom image id, or VHD blob URI.\nSee vm ' \ - 'create -h for more information on specifying an image.'.format(namespace.image) - raise CLIError(err) - - -def _get_image_plan_info_if_exists(cmd, namespace): - try: - compute_client = _compute_client_factory(cmd.cli_ctx) - if namespace.os_version.lower() == 'latest': - image_version = _get_latest_image_version(cmd.cli_ctx, namespace.location, namespace.os_publisher, - namespace.os_offer, namespace.os_sku) - else: - image_version = namespace.os_version - - image = compute_client.virtual_machine_images.get(namespace.location, - namespace.os_publisher, - namespace.os_offer, - namespace.os_sku, - image_version) - - # pylint: disable=no-member - return image.plan - except ResourceNotFoundError as ex: - logger.warning("Querying the image of '%s' failed for an error '%s'. Configuring plan settings " - "will be skipped", namespace.image, ex.message) - - -# pylint: disable=inconsistent-return-statements, too-many-return-statements -def _get_storage_profile_description(profile): - if profile == StorageProfile.SACustomImage: - return 'create unmanaged OS disk created from generalized VHD' - if profile == StorageProfile.SAPirImage: - return 'create unmanaged OS disk from Azure Marketplace image' - if profile == StorageProfile.SASpecializedOSDisk: - return 'attach to existing unmanaged OS disk' - if profile == StorageProfile.ManagedCustomImage: - return 'create managed OS disk from custom image' - if profile == StorageProfile.ManagedPirImage: - return 'create managed OS disk from Azure Marketplace image' - if profile == StorageProfile.ManagedSpecializedOSDisk: - return 'attach existing managed OS disk' - if profile == StorageProfile.SharedGalleryImage: - return 'create OS disk from shared gallery image' - if profile == StorageProfile.CommunityGalleryImage: - return 'create OS disk from community gallery image' - - -def _validate_location(cmd, namespace, zone_info, size_info): - if not namespace.location: - get_default_location_from_resource_group(cmd, namespace) - if zone_info and size_info: - sku_infos = list_sku_info(cmd.cli_ctx, namespace.location) - temp = next((x for x in sku_infos if x['name'].lower() == size_info.lower()), None) - # For Stack (compute - 2017-03-30), Resource_sku doesn't implement location_info property - if not temp.get('locationInfo', None): - return - if not temp or not [x for x in temp.get('locationInfo', []) if x.get('zones', None)]: - raise CLIError("{}'s location can't be used to create the VM/VMSS because availability zone is not yet " - "supported. Please use '--location' to specify a capable one. 'az vm list-skus' can be " - "used to find such locations".format(namespace.resource_group_name)) - - -# pylint: disable=too-many-branches, too-many-statements, too-many-locals -def _validate_vm_create_storage_profile(cmd, namespace, for_scale_set=False): - from azure.mgmt.core.tools import parse_resource_id - - _validate_vm_vmss_create_ephemeral_placement(namespace) - - # specialized is only for image - if getattr(namespace, 'specialized', None) is not None and namespace.image is None: - raise CLIError('usage error: --specialized is only configurable when --image is specified.') - - # use minimal parameters to resolve the expected storage profile - if getattr(namespace, 'attach_os_disk', None) and not namespace.image: - if namespace.use_unmanaged_disk: - # STORAGE PROFILE #3 - namespace.storage_profile = StorageProfile.SASpecializedOSDisk - else: - # STORAGE PROFILE #6 - namespace.storage_profile = StorageProfile.ManagedSpecializedOSDisk - elif namespace.image and not getattr(namespace, 'attach_os_disk', None): - image_type = _parse_image_argument(cmd, namespace) - if image_type == 'uri': - # STORAGE PROFILE #2 - namespace.storage_profile = StorageProfile.SACustomImage - elif image_type == 'image_id': - # STORAGE PROFILE #5 - namespace.storage_profile = StorageProfile.ManagedCustomImage - elif image_type == 'shared_gallery_image_id': - namespace.storage_profile = StorageProfile.SharedGalleryImage - elif image_type == 'community_gallery_image_id': - namespace.storage_profile = StorageProfile.CommunityGalleryImage - elif image_type == 'urn': - if namespace.use_unmanaged_disk: - # STORAGE PROFILE #1 - namespace.storage_profile = StorageProfile.SAPirImage - else: - # STORAGE PROFILE #4 - namespace.storage_profile = StorageProfile.ManagedPirImage - else: - raise CLIError('Unrecognized image type: {}'.format(image_type)) - elif not namespace.image and not getattr(namespace, 'attach_os_disk', None): - namespace.image = 'MicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition:latest' - _parse_image_argument(cmd, namespace) - namespace.storage_profile = StorageProfile.ManagedPirImage - if namespace.enable_secure_boot is None: - namespace.enable_secure_boot = True - if namespace.enable_vtpm is None: - namespace.enable_vtpm = True - if namespace.security_type is None: - namespace.security_type = 'TrustedLaunch' - else: - # did not specify image XOR attach-os-disk - raise CLIError('incorrect usage: --image IMAGE | --attach-os-disk DISK') - - auth_params = ['admin_password', 'admin_username', 'authentication_type', - 'generate_ssh_keys', 'ssh_dest_key_path', 'ssh_key_value'] - - # perform parameter validation for the specific storage profile - # start with the required/forbidden parameters for VM - if namespace.storage_profile == StorageProfile.ManagedPirImage: - required = ['image'] - forbidden = ['os_type', 'attach_os_disk', 'storage_account', - 'storage_container_name', 'use_unmanaged_disk'] - if for_scale_set: - forbidden.append('os_disk_name') - - elif namespace.storage_profile == StorageProfile.ManagedCustomImage: - required = ['image'] - forbidden = ['os_type', 'attach_os_disk', 'storage_account', - 'storage_container_name', 'use_unmanaged_disk'] - if for_scale_set: - forbidden.append('os_disk_name') - - elif namespace.storage_profile == StorageProfile.SharedGalleryImage: - required = ['image'] - forbidden = ['attach_os_disk', 'storage_account', 'storage_container_name', 'use_unmanaged_disk'] - - elif namespace.storage_profile == StorageProfile.CommunityGalleryImage: - required = ['image'] - forbidden = ['attach_os_disk', 'storage_account', 'storage_container_name', 'use_unmanaged_disk'] - - elif namespace.storage_profile == StorageProfile.ManagedSpecializedOSDisk: - required = ['os_type', 'attach_os_disk'] - forbidden = ['os_disk_name', 'os_caching', 'storage_account', 'ephemeral_os_disk', - 'storage_container_name', 'use_unmanaged_disk', 'storage_sku'] + auth_params - - elif namespace.storage_profile == StorageProfile.SAPirImage: - required = ['image', 'use_unmanaged_disk'] - forbidden = ['os_type', 'attach_os_disk', 'data_disk_sizes_gb', 'ephemeral_os_disk'] - - elif namespace.storage_profile == StorageProfile.SACustomImage: - required = ['image', 'os_type', 'use_unmanaged_disk'] - forbidden = ['attach_os_disk', 'data_disk_sizes_gb', 'ephemeral_os_disk'] - - elif namespace.storage_profile == StorageProfile.SASpecializedOSDisk: - required = ['os_type', 'attach_os_disk', 'use_unmanaged_disk'] - forbidden = ['os_disk_name', 'os_caching', 'image', 'storage_account', 'ephemeral_os_disk', - 'storage_container_name', 'data_disk_sizes_gb', 'storage_sku'] + auth_params - - else: - raise CLIError('Unrecognized storage profile: {}'.format(namespace.storage_profile)) - - logger.debug("storage profile '%s'", namespace.storage_profile) - - if for_scale_set: - # VMSS lacks some parameters, so scrub these out - props_to_remove = ['attach_os_disk', 'storage_account'] - for prop in props_to_remove: - if prop in required: - required.remove(prop) - if prop in forbidden: - forbidden.remove(prop) - - # set default storage SKU if not provided and using an image based OS - if not namespace.storage_sku and namespace.storage_profile in [StorageProfile.SAPirImage, - StorageProfile.SACustomImage]: # pylint: disable=line-too-long - namespace.storage_sku = ['Standard_LRS'] if for_scale_set else ['Premium_LRS'] - - if namespace.ultra_ssd_enabled is None and namespace.storage_sku: - for sku in namespace.storage_sku: - if 'ultrassd_lrs' in sku.lower(): - namespace.ultra_ssd_enabled = True - - # Now verify the presence of required and absence of forbidden parameters - validate_parameter_set( - namespace, required, forbidden, - description='storage profile: {}:'.format(_get_storage_profile_description(namespace.storage_profile))) - - image_data_disks = [] - if namespace.storage_profile == StorageProfile.ManagedCustomImage: - # extract additional information from a managed custom image - res = parse_resource_id(namespace.image) - namespace.aux_subscriptions = [res['subscription']] - compute_client = _compute_client_factory(cmd.cli_ctx, subscription_id=res['subscription']) - if res['type'].lower() == 'images': - image_info = compute_client.images.get(res['resource_group'], res['name']) - namespace.os_type = image_info.storage_profile.os_disk.os_type - image_data_disks = image_info.storage_profile.data_disks or [] - image_data_disks = [{'lun': disk.lun} for disk in image_data_disks] - - elif res['type'].lower() == 'galleries': - image_info = compute_client.gallery_images.get(resource_group_name=res['resource_group'], - gallery_name=res['name'], - gallery_image_name=res['child_name_1']) - namespace.os_type = image_info.os_type - gallery_image_version = res.get('child_name_2', '') - if gallery_image_version.lower() in ['latest', '']: - SigImageVersionList = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "sig.image_version").List - image_version_infos = SigImageVersionList(cli_ctx=cmd.cli_ctx)(command_args={ - "resource_group": res['resource_group'], - "gallery_name": res['name'], - "gallery_image_definition": res['child_name_1'] - }) - image_version_infos = [x for x in image_version_infos - if not x.get("publishingProfile", {}).get("excludeFromLatest", None)] - if not image_version_infos: - raise CLIError('There is no latest image version exists for "{}"'.format(namespace.image)) - image_version_info = sorted(image_version_infos, - key=lambda x: x["publishingProfile"]["publishedDate"])[-1] - image_data_disks = image_version_info.get("storageProfile", {}).get("dataDiskImages", []) or [] - image_data_disks = [{'lun': disk["lun"]} for disk in image_data_disks] - else: - SigImageVersionShow = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "sig.image_version").Show - image_version_info = SigImageVersionShow(cli_ctx=cmd.cli_ctx)(command_args={ - "resource_group": res['resource_group'], - "gallery_name": res['name'], - "gallery_image_definition": res['child_name_1'], - "gallery_image_version_name": res['child_name_2'], - }) - image_data_disks = image_version_info.get("storageProfile", {}).get("dataDiskImages", []) or [] - image_data_disks = [{'lun': disk["lun"]} for disk in image_data_disks] - - else: - raise CLIError('usage error: unrecognized image information "{}"'.format(namespace.image)) - - # pylint: disable=no-member - - elif namespace.storage_profile == StorageProfile.ManagedSpecializedOSDisk: - # accept disk name or ID - namespace.attach_os_disk = _get_resource_id( - cmd.cli_ctx, namespace.attach_os_disk, namespace.resource_group_name, 'disks', 'Microsoft.Compute') - - if getattr(namespace, 'attach_data_disks', None): - if not namespace.use_unmanaged_disk: - namespace.attach_data_disks = [_get_resource_id(cmd.cli_ctx, d, namespace.resource_group_name, 'disks', - 'Microsoft.Compute') for d in namespace.attach_data_disks] - - if namespace.storage_profile == StorageProfile.SharedGalleryImage: - - if namespace.location is None: - raise RequiredArgumentMissingError( - 'Please input the location of the shared gallery image through the parameter --location.') - - from ._vm_utils import parse_shared_gallery_image_id - image_info = parse_shared_gallery_image_id(namespace.image) - - from ._client_factory import cf_shared_gallery_image - shared_gallery_image_info = cf_shared_gallery_image(cmd.cli_ctx).get( - location=namespace.location, gallery_unique_name=image_info[0], gallery_image_name=image_info[1]) - - if namespace.os_type and namespace.os_type.lower() != shared_gallery_image_info.os_type.lower(): - raise ArgumentUsageError("The --os-type is not the correct os type of this shared gallery image, " - "the os type of this image should be {}".format(shared_gallery_image_info.os_type)) - namespace.os_type = shared_gallery_image_info.os_type - - if namespace.storage_profile == StorageProfile.CommunityGalleryImage: - - if namespace.location is None: - raise RequiredArgumentMissingError( - 'Please input the location of the community gallery image through the parameter --location.') - - from ._vm_utils import parse_community_gallery_image_id - image_info = parse_community_gallery_image_id(namespace.image) - - from ._client_factory import cf_community_gallery_image - community_gallery_image_info = cf_community_gallery_image(cmd.cli_ctx).get( - location=namespace.location, public_gallery_name=image_info[0], gallery_image_name=image_info[1]) - - if namespace.os_type and namespace.os_type.lower() != community_gallery_image_info.os_type.lower(): - raise ArgumentUsageError( - "The --os-type is not the correct os type of this community gallery image, " - "the os type of this image should be {}".format(community_gallery_image_info.os_type)) - namespace.os_type = community_gallery_image_info.os_type - - if getattr(namespace, 'security_type', None) == 'ConfidentialVM' and \ - not getattr(namespace, 'os_disk_security_encryption_type', None): - raise RequiredArgumentMissingError('usage error: "--os-disk-security-encryption-type" is required ' - 'when "--security-type" is specified as "ConfidentialVM"') - - if getattr(namespace, 'os_disk_secure_vm_disk_encryption_set', None) and \ - getattr(namespace, 'os_disk_security_encryption_type', None) != 'DiskWithVMGuestState': - raise ArgumentUsageError( - 'usage error: The "--os-disk-secure-vm-disk-encryption-set" can only be passed in ' - 'when "--os-disk-security-encryption-type" is "DiskWithVMGuestState"') - - os_disk_security_encryption_type = getattr(namespace, 'os_disk_security_encryption_type', None) - if os_disk_security_encryption_type and os_disk_security_encryption_type.lower() == 'nonpersistedtpm': - if ((getattr(namespace, 'security_type', None) != 'ConfidentialVM') or - not getattr(namespace, 'enable_vtpm', None)): - raise ArgumentUsageError( - 'usage error: The "--os-disk-security-encryption-type NonPersistedTPM" can only be passed in ' - 'when "--security-type" is "ConfidentialVM" and "--enable-vtpm" is True') - - if not namespace.os_type: - namespace.os_type = 'windows' if 'windows' in namespace.os_offer.lower() else 'linux' - - if getattr(namespace, 'source_snapshots_or_disks', None) and \ - getattr(namespace, 'source_snapshots_or_disks_size_gb', None): - if len(namespace.source_snapshots_or_disks) != len(namespace.source_snapshots_or_disks_size_gb): - raise ArgumentUsageError( - 'Length of --source-snapshots-or-disks, --source-snapshots-or-disks-size-gb must be same.') - elif getattr(namespace, 'source_snapshots_or_disks', None) or \ - getattr(namespace, 'source_snapshots_or_disks_size_gb', None): - raise ArgumentUsageError('usage error: --source-snapshots-or-disks and ' - '--source-snapshots-or-disks-size-gb must be used together') - - if getattr(namespace, 'source_disk_restore_point', None) and \ - getattr(namespace, 'source_disk_restore_point_size_gb', None): - if len(namespace.source_disk_restore_point) != len(namespace.source_disk_restore_point_size_gb): - raise ArgumentUsageError( - 'Length of --source-disk-restore-point, --source-disk-restore-point-size-gb must be same.') - elif getattr(namespace, 'source_disk_restore_point', None) or \ - getattr(namespace, 'source_disk_restore_point_size_gb', None): - raise ArgumentUsageError('usage error: --source-disk-restore-point and ' - '--source-disk-restore-point-size-gb must be used together') - - from ._vm_utils import normalize_disk_info - # attach_data_disks are not exposed yet for VMSS, so use 'getattr' to avoid crash - vm_size = (getattr(namespace, 'size', None) or getattr(namespace, 'vm_sku', None)) - - # pylint: disable=line-too-long - namespace.disk_info = normalize_disk_info(size=vm_size, - image_data_disks=image_data_disks, - data_disk_sizes_gb=namespace.data_disk_sizes_gb, - attach_data_disks=getattr(namespace, 'attach_data_disks', []), - storage_sku=namespace.storage_sku, - os_disk_caching=namespace.os_caching, - data_disk_cachings=namespace.data_caching, - ephemeral_os_disk=getattr(namespace, 'ephemeral_os_disk', None), - ephemeral_os_disk_placement=getattr(namespace, - 'ephemeral_os_disk_placement', None), - data_disk_delete_option=getattr( - namespace, 'data_disk_delete_option', None), - source_snapshots_or_disks=getattr(namespace, 'source_snapshots_or_disks', - None), - source_snapshots_or_disks_size_gb=getattr(namespace, - 'source_snapshots_or_disks_size_gb', - None), - source_disk_restore_point=getattr(namespace, 'source_disk_restore_point', - None), - source_disk_restore_point_size_gb=getattr(namespace, - 'source_disk_restore_point_size_gb', - None) - ) - - -def _validate_vm_create_storage_account(cmd, namespace): - from azure.mgmt.core.tools import parse_resource_id - if namespace.storage_account: - storage_id = parse_resource_id(namespace.storage_account) - rg = storage_id.get('resource_group', namespace.resource_group_name) - if check_existence(cmd.cli_ctx, storage_id['name'], rg, 'Microsoft.Storage', 'storageAccounts'): - # 1 - existing storage account specified - namespace.storage_account_type = 'existing' - logger.debug("using specified existing storage account '%s'", storage_id['name']) - else: - # 2 - params for new storage account specified - namespace.storage_account_type = 'new' - logger.debug("specified storage account '%s' not found and will be created", storage_id['name']) - else: - from azure.cli.core.profiles import ResourceType - from azure.cli.core.commands.client_factory import get_mgmt_service_client - storage_client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_STORAGE).storage_accounts - - # find storage account in target resource group that matches the VM's location - sku_tier = 'Standard' - for sku in namespace.storage_sku: - if 'Premium' in sku: - sku_tier = 'Premium' - break - - account = next( - (a for a in storage_client.list_by_resource_group(namespace.resource_group_name) - if a.sku.tier == sku_tier and a.location == namespace.location), None) - - if account: - # 3 - nothing specified - find viable storage account in target resource group - namespace.storage_account = account.name - namespace.storage_account_type = 'existing' - logger.debug("suitable existing storage account '%s' will be used", account.name) - else: - # 4 - nothing specified - create a new storage account - namespace.storage_account_type = 'new' - logger.debug('no suitable storage account found. One will be created.') - - -def _validate_vm_create_availability_set(cmd, namespace): - from azure.mgmt.core.tools import parse_resource_id, resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - if namespace.availability_set: - as_id = parse_resource_id(namespace.availability_set) - name = as_id['name'] - rg = as_id.get('resource_group', namespace.resource_group_name) - - if not check_existence(cmd.cli_ctx, name, rg, 'Microsoft.Compute', 'availabilitySets'): - raise CLIError("Availability set '{}' does not exist.".format(name)) - - namespace.availability_set = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=rg, - namespace='Microsoft.Compute', - type='availabilitySets', - name=name) - logger.debug("adding to specified availability set '%s'", namespace.availability_set) - - -def _validate_vm_create_vmss(cmd, namespace): - from azure.mgmt.core.tools import parse_resource_id, resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - if namespace.vmss: - as_id = parse_resource_id(namespace.vmss) - name = as_id['name'] - rg = as_id.get('resource_group', namespace.resource_group_name) - - if not check_existence(cmd.cli_ctx, name, rg, 'Microsoft.Compute', 'virtualMachineScaleSets'): - raise CLIError("virtual machine scale set '{}' does not exist.".format(name)) - - namespace.vmss = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=rg, - namespace='Microsoft.Compute', - type='virtualMachineScaleSets', - name=name) - logger.debug("adding to specified virtual machine scale set '%s'", namespace.vmss) - - -def _validate_vm_create_dedicated_host(cmd, namespace): - """ - "host": { - "$ref": "#/definitions/SubResource", - "description": "Specifies information about the dedicated host that the virtual machine resides in. -

Minimum api-version: 2018-10-01." - }, - "hostGroup": { - "$ref": "#/definitions/SubResource", - "description": "Specifies information about the dedicated host group that the virtual machine resides in. -

Minimum api-version: 2020-06-01.

NOTE: User cannot specify both host and hostGroup properties." - } - - :param cmd: - :param namespace: - :return: - """ - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - - if namespace.dedicated_host and namespace.dedicated_host_group: - raise CLIError('usage error: User cannot specify both --host and --host-group properties.') - - if namespace.dedicated_host and not is_valid_resource_id(namespace.dedicated_host): - raise CLIError('usage error: --host is not a valid resource ID.') - - if namespace.dedicated_host_group: - if not is_valid_resource_id(namespace.dedicated_host_group): - namespace.dedicated_host_group = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=namespace.resource_group_name, - namespace='Microsoft.Compute', type='hostGroups', name=namespace.dedicated_host_group - ) - - -def _validate_vm_vmss_create_vnet(cmd, namespace, for_scale_set=False): - from azure.mgmt.core.tools import is_valid_resource_id - vnet = namespace.vnet_name - subnet = namespace.subnet - rg = namespace.resource_group_name - location = namespace.location - nics = getattr(namespace, 'nics', None) - - if vnet and '/' in vnet: - raise CLIError("incorrect usage: --subnet ID | --subnet NAME --vnet-name NAME") - - if not vnet and not subnet and not nics: - logger.debug('no subnet specified. Attempting to find an existing Vnet and subnet...') - - # if nothing specified, try to find an existing vnet and subnet in the target resource group - VnetList = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.vnet").List - - vnet_list = VnetList(cli_ctx=cmd.cli_ctx)(command_args={ - "resource_group": rg - }) - - # find VNET in target resource group that matches the VM's location with a matching subnet - for vnet_match in (v for v in vnet_list if bool(v['location'] == location and v['subnets'])): - # 1 - find a suitable existing vnet/subnet - result = None - if not for_scale_set: - result = next((s for s in vnet_match['subnets'] if s['name'].lower() != 'gatewaysubnet'), None) - else: - def _check_subnet(s): - if s['name'].lower() == 'gatewaysubnet': - return False - subnet_mask = s['addressPrefix'].split('/')[-1] - return _subnet_capacity_check(subnet_mask, namespace.instance_count, - not namespace.disable_overprovision) - - result = next((s for s in vnet_match['subnets'] if _check_subnet(s)), None) - if not result: - continue - namespace.subnet = result['name'] - namespace.vnet_name = vnet_match['name'] - namespace.vnet_type = 'existing' - logger.debug("existing vnet '%s' and subnet '%s' found", namespace.vnet_name, namespace.subnet) - return - - if subnet: - subnet_is_id = is_valid_resource_id(subnet) - if (subnet_is_id and vnet) or (not subnet_is_id and not vnet): - raise CLIError("incorrect usage: --subnet ID | --subnet NAME --vnet-name NAME") - - subnet_exists = \ - check_existence(cmd.cli_ctx, subnet, rg, 'Microsoft.Network', 'subnets', vnet, 'virtualNetworks') - - if subnet_is_id and not subnet_exists: - raise CLIError("Subnet '{}' does not exist.".format(subnet)) - if subnet_exists: - # 2 - user specified existing vnet/subnet - namespace.vnet_type = 'existing' - logger.debug("using specified vnet '%s' and subnet '%s'", namespace.vnet_name, namespace.subnet) - return - # 3 - create a new vnet/subnet - namespace.vnet_type = 'new' - logger.debug('no suitable subnet found. One will be created.') - - -def _subnet_capacity_check(subnet_mask, vmss_instance_count, over_provision): - mask = int(subnet_mask) - # '2' are the reserved broadcasting addresses - # '*1.5' so we have enough leeway for over-provision - factor = 1.5 if over_provision else 1 - return ((1 << (32 - mask)) - 2) > int(vmss_instance_count * factor) - - -def _validate_vm_vmss_accelerated_networking(cli_ctx, namespace): - if namespace.accelerated_networking is None: - size = getattr(namespace, 'size', None) or getattr(namespace, 'vm_sku', None) - size = size.lower() - - # Use the following code to refresh the list - # skus = list_sku_info(cli_ctx, namespace.location) - # aval_sizes = [x.name.lower() for x in skus if x.resource_type == 'virtualMachines' and - # any(c.name == 'AcceleratedNetworkingEnabled' and c.value == 'True' for c in x.capabilities)] - - aval_sizes = ['standard_b12ms', 'standard_b16ms', 'standard_b20ms', 'standard_ds2_v2', 'standard_ds3_v2', - 'standard_ds4_v2', 'standard_ds5_v2', 'standard_ds11-1_v2', 'standard_ds11_v2', - 'standard_ds12-1_v2', 'standard_ds12-2_v2', 'standard_ds12_v2', 'standard_ds13-2_v2', - 'standard_ds13-4_v2', 'standard_ds13_v2', 'standard_ds14-4_v2', 'standard_ds14-8_v2', - 'standard_ds14_v2', 'standard_ds15_v2', 'standard_ds2_v2_promo', 'standard_ds3_v2_promo', - 'standard_ds4_v2_promo', 'standard_ds5_v2_promo', 'standard_ds11_v2_promo', - 'standard_ds12_v2_promo', 'standard_ds13_v2_promo', 'standard_ds14_v2_promo', 'standard_f2s', - 'standard_f4s', 'standard_f8s', 'standard_f16s', 'standard_d4s_v3', 'standard_d8s_v3', - 'standard_d16s_v3', 'standard_d32s_v3', 'standard_d2_v2', 'standard_d3_v2', 'standard_d4_v2', - 'standard_d5_v2', 'standard_d11_v2', 'standard_d12_v2', 'standard_d13_v2', 'standard_d14_v2', - 'standard_d15_v2', 'standard_d2_v2_promo', 'standard_d3_v2_promo', 'standard_d4_v2_promo', - 'standard_d5_v2_promo', 'standard_d11_v2_promo', 'standard_d12_v2_promo', 'standard_d13_v2_promo', - 'standard_d14_v2_promo', 'standard_f2', 'standard_f4', 'standard_f8', 'standard_f16', - 'standard_d4_v3', 'standard_d8_v3', 'standard_d16_v3', 'standard_d32_v3', 'standard_d48_v3', - 'standard_d64_v3', 'standard_d48s_v3', 'standard_d64s_v3', 'standard_e4_v3', 'standard_e8_v3', - 'standard_e16_v3', 'standard_e20_v3', 'standard_e32_v3', 'standard_e48_v3', 'standard_e64i_v3', - 'standard_e64_v3', 'standard_e4-2s_v3', 'standard_e4s_v3', 'standard_e8-2s_v3', - 'standard_e8-4s_v3', 'standard_e8s_v3', 'standard_e16-4s_v3', 'standard_e16-8s_v3', - 'standard_e16s_v3', 'standard_e20s_v3', 'standard_e32-8s_v3', 'standard_e32-16s_v3', - 'standard_e32s_v3', 'standard_e48s_v3', 'standard_e64-16s_v3', 'standard_e64-32s_v3', - 'standard_e64is_v3', 'standard_e64s_v3', 'standard_l8s_v2', 'standard_l16s_v2', - 'standard_l32s_v2', 'standard_l48s_v2', 'standard_l64s_v2', 'standard_l80s_v2', 'standard_e4_v4', - 'standard_e8_v4', 'standard_e16_v4', 'standard_e20_v4', 'standard_e32_v4', 'standard_e48_v4', - 'standard_e64_v4', 'standard_e4d_v4', 'standard_e8d_v4', 'standard_e16d_v4', 'standard_e20d_v4', - 'standard_e32d_v4', 'standard_e48d_v4', 'standard_e64d_v4', 'standard_e4-2s_v4', - 'standard_e4s_v4', 'standard_e8-2s_v4', 'standard_e8-4s_v4', 'standard_e8s_v4', - 'standard_e16-4s_v4', 'standard_e16-8s_v4', 'standard_e16s_v4', 'standard_e20s_v4', - 'standard_e32-8s_v4', 'standard_e32-16s_v4', 'standard_e32s_v4', 'standard_e48s_v4', - 'standard_e64-16s_v4', 'standard_e64-32s_v4', 'standard_e64s_v4', 'standard_e4-2ds_v4', - 'standard_e4ds_v4', 'standard_e8-2ds_v4', 'standard_e8-4ds_v4', 'standard_e8ds_v4', - 'standard_e16-4ds_v4', 'standard_e16-8ds_v4', 'standard_e16ds_v4', 'standard_e20ds_v4', - 'standard_e32-8ds_v4', 'standard_e32-16ds_v4', 'standard_e32ds_v4', 'standard_e48ds_v4', - 'standard_e64-16ds_v4', 'standard_e64-32ds_v4', 'standard_e64ds_v4', 'standard_d4d_v4', - 'standard_d8d_v4', 'standard_d16d_v4', 'standard_d32d_v4', 'standard_d48d_v4', 'standard_d64d_v4', - 'standard_d4_v4', 'standard_d8_v4', 'standard_d16_v4', 'standard_d32_v4', 'standard_d48_v4', - 'standard_d64_v4', 'standard_d4ds_v4', 'standard_d8ds_v4', 'standard_d16ds_v4', - 'standard_d32ds_v4', 'standard_d48ds_v4', 'standard_d64ds_v4', 'standard_d4s_v4', - 'standard_d8s_v4', 'standard_d16s_v4', 'standard_d32s_v4', 'standard_d48s_v4', 'standard_d64s_v4', - 'standard_f4s_v2', 'standard_f8s_v2', 'standard_f16s_v2', 'standard_f32s_v2', 'standard_f48s_v2', - 'standard_f64s_v2', 'standard_f72s_v2', 'standard_m208ms_v2', 'standard_m208s_v2', - 'standard_m416-208s_v2', 'standard_m416s_v2', 'standard_m416-208ms_v2', 'standard_m416ms_v2', - 'standard_m64', 'standard_m64m', 'standard_m128', 'standard_m128m', 'standard_m8-2ms', - 'standard_m8-4ms', 'standard_m8ms', 'standard_m16-4ms', 'standard_m16-8ms', 'standard_m16ms', - 'standard_m32-8ms', 'standard_m32-16ms', 'standard_m32ls', 'standard_m32ms', 'standard_m32ts', - 'standard_m64-16ms', 'standard_m64-32ms', 'standard_m64ls', 'standard_m64ms', 'standard_m64s', - 'standard_m128-32ms', 'standard_m128-64ms', 'standard_m128ms', 'standard_m128s', - 'standard_d4a_v4', 'standard_d8a_v4', 'standard_d16a_v4', 'standard_d32a_v4', 'standard_d48a_v4', - 'standard_d64a_v4', 'standard_d96a_v4', 'standard_d4as_v4', 'standard_d8as_v4', - 'standard_d16as_v4', 'standard_d32as_v4', 'standard_d48as_v4', 'standard_d64as_v4', - 'standard_d96as_v4', 'standard_e4a_v4', 'standard_e8a_v4', 'standard_e16a_v4', 'standard_e20a_v4', - 'standard_e32a_v4', 'standard_e48a_v4', 'standard_e64a_v4', 'standard_e96a_v4', - 'standard_e4as_v4', 'standard_e8as_v4', 'standard_e16as_v4', 'standard_e20as_v4', - 'standard_e32as_v4', 'standard_e48as_v4', 'standard_e64as_v4', 'standard_e96as_v4'] - if size not in aval_sizes: - return - - new_4core_sizes = ['Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D3_v2_ABC', 'Standard_DS3_v2', - 'Standard_DS3_v2_Promo', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D12_v2_ABC', - 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_F8s_v2', 'Standard_F4', - 'Standard_F4_ABC', 'Standard_F4s', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_D8_v3', - 'Standard_D8s_v3'] - new_4core_sizes = [x.lower() for x in new_4core_sizes] - if size not in new_4core_sizes: - compute_client = _compute_client_factory(cli_ctx) - sizes = compute_client.virtual_machine_sizes.list(namespace.location) - size_info = next((s for s in sizes if s.name.lower() == size), None) - if size_info is None or size_info.number_of_cores < 8: - return - - # VMs need to be a supported image in the marketplace - # Ubuntu 16.04 | 18.04, SLES 12 SP3, RHEL 7.4, CentOS 7.4, Flatcar, Debian "Stretch" with backports kernel - # Oracle Linux 7.4, Windows Server 2016, Windows Server 2012R2 - publisher, offer, sku = namespace.os_publisher, namespace.os_offer, namespace.os_sku - if not publisher: - return - publisher, offer, sku = publisher.lower(), offer.lower(), sku.lower() - - if publisher == 'coreos' or offer == 'coreos': - from azure.cli.core.parser import InvalidArgumentValueError - raise InvalidArgumentValueError("As CoreOS is deprecated and there is no image in the marketplace any more," - " please use Flatcar Container Linux instead.") - - distros = [('canonical', 'UbuntuServer', '^16.04|^18.04'), - ('suse', 'sles', '^12-sp3'), ('redhat', 'rhel', '^7.4'), - ('openlogic', 'centos', '^7.4'), ('kinvolk', 'flatcar-container-linux-free', None), - ('kinvolk', 'flatcar-container-linux', None), ('credativ', 'debian', '-backports'), - ('oracle', 'oracle-linux', '^7.4'), ('MicrosoftWindowsServer', 'WindowsServer', '^2016'), - ('MicrosoftWindowsServer', 'WindowsServer', '^2012-R2')] - import re - for p, o, s in distros: - if p.lower() == publisher and (o is None or o.lower() == offer) and (s is None or re.match(s, sku, re.I)): - namespace.accelerated_networking = True - - -def _validate_vmss_create_subnet(namespace): - if namespace.vnet_type == 'new': - if namespace.subnet_address_prefix is None: - cidr = namespace.vnet_address_prefix.split('/', 1)[0] - i = 0 - for i in range(24, 16, -1): - if _subnet_capacity_check(i, namespace.instance_count, not namespace.disable_overprovision): - break - if i < 16: - err = "instance count '{}' is out of range of 2^16 subnet size'" - raise CLIError(err.format(namespace.instance_count)) - namespace.subnet_address_prefix = '{}/{}'.format(cidr, i) - - if namespace.app_gateway_type and namespace.app_gateway_subnet_address_prefix is None: - namespace.app_gateway_subnet_address_prefix = _get_next_subnet_addr_suffix( - namespace.vnet_address_prefix, namespace.subnet_address_prefix, 24) - - -def _get_next_subnet_addr_suffix(vnet_cidr, subnet_cidr, new_mask): - def _convert_to_int(address, bit_mask_len): - a, b, c, d = [int(x) for x in address.split('.')] - result = '{0:08b}{1:08b}{2:08b}{3:08b}'.format(a, b, c, d) - return int(result[:-bit_mask_len], 2) - - error_msg = "usage error: --subnet-address-prefix value should be a subrange of --vnet-address-prefix's" - # extract vnet information needed to verify the defaults we are coming out - vnet_ip_address, mask = vnet_cidr.split('/') - vnet_bit_mask_len = 32 - int(mask) - vnet_int = _convert_to_int(vnet_ip_address, vnet_bit_mask_len) - - subnet_ip_address, mask = subnet_cidr.split('/') - subnet_bit_mask_len = 32 - int(mask) - - if vnet_bit_mask_len <= subnet_bit_mask_len: - raise CLIError(error_msg) - - candidate_int = _convert_to_int(subnet_ip_address, subnet_bit_mask_len) + 1 - if (candidate_int >> (vnet_bit_mask_len - subnet_bit_mask_len)) > vnet_int: # overflows? - candidate_int = candidate_int - 2 # try the other way around - if (candidate_int >> (vnet_bit_mask_len - subnet_bit_mask_len)) > vnet_int: - raise CLIError(error_msg) - - # format back to the cidr - candaidate_str = '{0:32b}'.format(candidate_int << subnet_bit_mask_len) - return '{0}.{1}.{2}.{3}/{4}'.format(int(candaidate_str[0:8], 2), int(candaidate_str[8:16], 2), - int(candaidate_str[16:24], 2), int(candaidate_str[24:32], 2), - new_mask) - - -def _validate_vm_create_nsg(cmd, namespace): - if namespace.nsg: - if check_existence(cmd.cli_ctx, namespace.nsg, namespace.resource_group_name, - 'Microsoft.Network', 'networkSecurityGroups'): - namespace.nsg_type = 'existing' - logger.debug("using specified NSG '%s'", namespace.nsg) - else: - namespace.nsg_type = 'new' - logger.debug("specified NSG '%s' not found. It will be created.", namespace.nsg) - elif namespace.nsg == '': - namespace.nsg_type = None - logger.debug('no NSG will be used') - elif namespace.nsg is None: - namespace.nsg_type = 'new' - logger.debug('new NSG will be created') - - -def _validate_vmss_create_nsg(cmd, namespace): - if namespace.nsg: - namespace.nsg = _get_resource_id(cmd.cli_ctx, namespace.nsg, namespace.resource_group_name, - 'networkSecurityGroups', 'Microsoft.Network') - - -def _validate_vm_vmss_create_public_ip(cmd, namespace): - if namespace.public_ip_address: - if check_existence(cmd.cli_ctx, namespace.public_ip_address, namespace.resource_group_name, - 'Microsoft.Network', 'publicIPAddresses'): - namespace.public_ip_address_type = 'existing' - logger.debug("using existing specified public IP '%s'", namespace.public_ip_address) - else: - namespace.public_ip_address_type = 'new' - logger.debug("specified public IP '%s' not found. It will be created.", namespace.public_ip_address) - elif namespace.public_ip_address == '': - namespace.public_ip_address_type = None - logger.debug('no public IP address will be used') - elif namespace.public_ip_address is None: - namespace.public_ip_address_type = 'new' - logger.debug('new public IP address will be created') - - # Use standard public IP address automatically when using zones. - if hasattr(namespace, 'zone') and namespace.zone is not None: - namespace.public_ip_sku = 'Standard' - - # Public-IP SKU is only exposed for VM. VMSS has no such needs so far - if getattr(namespace, 'public_ip_sku', None): - if namespace.public_ip_sku == 'Standard': - if not namespace.public_ip_address_allocation: - namespace.public_ip_address_allocation = 'Static' - - -def _validate_vmss_create_public_ip(cmd, namespace): - if namespace.load_balancer_type is None and namespace.app_gateway_type is None: - if namespace.public_ip_address: - raise CLIError('--public-ip-address can only be used when creating a new load ' - 'balancer or application gateway frontend.') - namespace.public_ip_address = '' - _validate_vm_vmss_create_public_ip(cmd, namespace) - - -def validate_delete_options(resources, delete_option): - """ Extracts multiple space-separated delete_option in key[=value] format """ - if resources and isinstance(delete_option, list): - if len(delete_option) == 1 and len(delete_option[0].split('=', 1)) == 1: - return delete_option[0] - delete_option_dict = {} - for item in delete_option: - delete_option_dict.update(validate_delete_option(item)) - return delete_option_dict - return None - - -def validate_delete_option(string): - """ Extracts a single delete_option in key[=value] format """ - from azure.cli.core.azclierror import InvalidArgumentValueError - result = {} - if string: - comps = string.split('=', 1) - if len(comps) == 2: - result = {comps[0]: comps[1]} - else: - raise InvalidArgumentValueError( - "Invalid value for delete option. Use a singular value to apply on all resources, or use " - "= to configure the delete behavior for individual resources.") - return result - - -def _validate_vm_create_nics(cmd, namespace): - from azure.mgmt.core.tools import resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - nic_ids = namespace.nics - delete_option = validate_delete_options(nic_ids, getattr(namespace, 'nic_delete_option', None)) - nics = [] - - if not nic_ids: - namespace.nic_type = 'new' - logger.debug('new NIC will be created') - return - - if not isinstance(nic_ids, list): - nic_ids = [nic_ids] - - for n in nic_ids: - nic = {'id': n if '/' in n else resource_id(name=n, - resource_group=namespace.resource_group_name, - namespace='Microsoft.Network', - type='networkInterfaces', - subscription=get_subscription_id(cmd.cli_ctx)), - 'properties': {'primary': nic_ids[0] == n} - } - if delete_option: - nic['properties']['deleteOption'] = delete_option if isinstance(delete_option, str) else \ - delete_option.get(n, None) - nics.append(nic) - - namespace.nics = nics - namespace.nic_type = 'existing' - namespace.public_ip_address_type = None - logger.debug('existing NIC(s) will be used') - - -def _validate_vm_nic_delete_option(namespace): - if not namespace.nics and namespace.nic_delete_option: - if len(namespace.nic_delete_option) == 1 and len( - namespace.nic_delete_option[0].split('=')) == 1: # pylint: disable=line-too-long - namespace.nic_delete_option = namespace.nic_delete_option[0] - elif len(namespace.nic_delete_option) > 1 or any((len(delete_option.split('=')) > 1 for delete_option in - namespace.nic_delete_option)): # pylint: disable=line-too-long - from azure.cli.core.parser import InvalidArgumentValueError - raise InvalidArgumentValueError("incorrect usage: Cannot specify individual delete option when no nic is " - "specified. Either specify a list of nics and their delete option like: " - "--nics nic1 nic2 --nic-delete-option nic1=Delete nic2=Detach or specify " - "delete option for all: --nics nic1 nic2 --nic-delete-option Delete or " - "specify delete option for the new nic created: --nic-delete-option Delete") - - -def _validate_vm_vmss_create_auth(namespace, cmd=None): - if namespace.storage_profile in [StorageProfile.ManagedSpecializedOSDisk, - StorageProfile.SASpecializedOSDisk]: - return - - if namespace.admin_username is None: - namespace.admin_username = get_default_admin_username() - if namespace.admin_username and namespace.os_type: - namespace.admin_username = _validate_admin_username(namespace.admin_username, namespace.os_type) - - # if not namespace.os_type: - # raise CLIError("Unable to resolve OS type. Specify '--os-type' argument.") - - if not namespace.authentication_type: - # if both ssh key and password, infer that authentication_type is all. - if namespace.ssh_key_value and namespace.admin_password: - namespace.authentication_type = 'all' - else: - # apply default auth type (password for Windows, ssh for Linux) by examining the OS type - namespace.authentication_type = 'password' \ - if ((namespace.os_type and namespace.os_type.lower() == 'windows') or - namespace.admin_password) else 'ssh' - - if namespace.os_type and namespace.os_type.lower() == 'windows' and namespace.authentication_type == 'ssh': - raise CLIError('SSH not supported for Windows VMs.') - - # validate proper arguments supplied based on the authentication type - if namespace.authentication_type == 'password': - if namespace.ssh_key_value or namespace.ssh_dest_key_path: - raise CLIError('SSH key cannot be used with password authentication type.') - - # if password not given, attempt to prompt user for password. - if not namespace.admin_password: - _prompt_for_password(namespace) - - # validate password - _validate_admin_password(namespace.admin_password, namespace.os_type) - - elif namespace.authentication_type == 'ssh': - - if namespace.admin_password: - raise CLIError('Admin password cannot be used with SSH authentication type.') - - validate_ssh_key(namespace, cmd) - - if not namespace.ssh_dest_key_path: - namespace.ssh_dest_key_path = '/home/{}/.ssh/authorized_keys'.format(namespace.admin_username) - - elif namespace.authentication_type == 'all': - if namespace.os_type and namespace.os_type.lower() == 'windows': - raise CLIError('SSH not supported for Windows VMs. Use password authentication.') - - if not namespace.admin_password: - _prompt_for_password(namespace) - _validate_admin_password(namespace.admin_password, namespace.os_type) - - validate_ssh_key(namespace, cmd) - if not namespace.ssh_dest_key_path: - namespace.ssh_dest_key_path = '/home/{}/.ssh/authorized_keys'.format(namespace.admin_username) - - -def _prompt_for_password(namespace): - from knack.prompting import prompt_pass, NoTTYException - try: - namespace.admin_password = prompt_pass('Admin Password: ', confirm=True) - except NoTTYException: - raise CLIError('Please specify password in non-interactive mode.') - - -def _validate_admin_username(username, os_type): - import re - if not username: - raise CLIError("admin user name can not be empty") - is_linux = os_type.lower() == 'linux' - # pylint: disable=line-too-long - pattern = (r'[\\\/"\[\]:|<>+=;,?*@#()!A-Z]+' if is_linux else r'[\\\/"\[\]:|<>+=;,?*@]+') - linux_err = r'admin user name cannot contain upper case character A-Z, special characters \/"[]:|<>+=;,?*@#()! or start with $ or -' - win_err = r'admin user name cannot contain special characters \/"[]:|<>+=;,?*@# or ends with .' - if re.findall(pattern, username): - raise CLIError(linux_err if is_linux else win_err) - if is_linux and re.findall(r'^[$-]+', username): - raise CLIError(linux_err) - if not is_linux and username.endswith('.'): - raise CLIError(win_err) - if username.lower() in DISALLOWED_USER_NAMES: - raise CLIError( - "This user name '{}' meets the general requirements, but is specifically disallowed for this image. Please try a different value.".format( - username)) - return username - - -def _validate_admin_password(password, os_type): - import re - is_linux = os_type.lower() == 'linux' - max_length = 72 if is_linux else 123 - min_length = 12 - - contains_lower = re.findall('[a-z]+', password) - contains_upper = re.findall('[A-Z]+', password) - contains_digit = re.findall('[0-9]+', password) - contains_special_char = re.findall(r'[ `~!@#$%^&*()=+_\[\]{}\|;:.\/\'\",<>?]+', password) - count = len([x for x in [contains_lower, contains_upper, - contains_digit, contains_special_char] if x]) - - # pylint: disable=line-too-long - error_msg = ("The password length must be between {} and {}. Password must have the 3 of the following: " - "1 lower case character, 1 upper case character, 1 number and 1 special character.").format(min_length, - max_length) - if len(password) not in range(min_length, max_length + 1) or count < 3: - raise CLIError(error_msg) - - -def validate_ssh_key(namespace, cmd=None): - from azure.core.exceptions import HttpResponseError - ssh_key_type = namespace.ssh_key_type if hasattr(namespace, 'ssh_key_type') else 'RSA' - if hasattr(namespace, 'ssh_key_name') and namespace.ssh_key_name: - client = _compute_client_factory(cmd.cli_ctx) - # --ssh-key-name - if not namespace.ssh_key_value and not namespace.generate_ssh_keys: - # Use existing key, key must exist - try: - ssh_key_resource = client.ssh_public_keys.get(namespace.resource_group_name, namespace.ssh_key_name) - except HttpResponseError: - raise ValidationError('SSH key {} does not exist!'.format(namespace.ssh_key_name)) - namespace.ssh_key_value = [ssh_key_resource.public_key] - logger.info('Get a key from --ssh-key-name successfully') - elif namespace.ssh_key_value: - raise ValidationError('--ssh-key-name and --ssh-key-values cannot be used together') - elif namespace.generate_ssh_keys: - parameters = {} - parameters['location'] = namespace.location - public_key = _validate_ssh_key_helper("", namespace.generate_ssh_keys, ssh_key_type) - parameters['public_key'] = public_key - client.ssh_public_keys.create(resource_group_name=namespace.resource_group_name, - ssh_public_key_name=namespace.ssh_key_name, - parameters=parameters) - namespace.ssh_key_value = [public_key] - elif namespace.ssh_key_value: - if namespace.generate_ssh_keys and len(namespace.ssh_key_value) > 1: - logger.warning("Ignoring --generate-ssh-keys as multiple ssh key values have been specified.") - namespace.generate_ssh_keys = False - - processed_ssh_key_values = [] - for ssh_key_value in namespace.ssh_key_value: - processed_ssh_key_values.append(_validate_ssh_key_helper(ssh_key_value, - namespace.generate_ssh_keys, - ssh_key_type)) - namespace.ssh_key_value = processed_ssh_key_values - # if no ssh keys processed, try to generate new key / use existing at root. - else: - namespace.ssh_key_value = [_validate_ssh_key_helper("", - namespace.generate_ssh_keys, - ssh_key_type)] - - -def _validate_ssh_key_helper(ssh_key_value, should_generate_ssh_keys, ssh_key_type=None): - file_name = 'id_rsa.pub' if ssh_key_type is None or ssh_key_type == 'RSA' else 'id_ed25519.pub' - string_or_file = (ssh_key_value or - os.path.join(os.path.expanduser('~'), '.ssh', file_name)) - - content = string_or_file - if os.path.exists(string_or_file): - logger.info('Use existing SSH public key file: %s', string_or_file) - with open(string_or_file, 'r') as f: - content = f.read() - elif not keys.is_valid_ssh_rsa_public_key(content): - if should_generate_ssh_keys: - # figure out appropriate file names: - # 'base_name'(with private keys), and 'base_name.pub'(with public keys) - public_key_filepath = string_or_file - if public_key_filepath[-4:].lower() == '.pub': - private_key_filepath = public_key_filepath[:-4] - else: - private_key_filepath = public_key_filepath + '.private' - - if ssh_key_type == "Ed25519": - from azure.cli.command_modules.vm.azure_stack._vm_utils import generate_ssh_keys_ed25519 - content = generate_ssh_keys_ed25519(private_key_filepath, public_key_filepath) - else: - content = keys.generate_ssh_keys(private_key_filepath, public_key_filepath) - logger.warning("SSH key files '%s' and '%s' have been generated under ~/.ssh to " - "allow SSH access to the VM. If using machines without " - "permanent storage, back up your keys to a safe location.", - private_key_filepath, public_key_filepath) - else: - raise CLIError('An RSA key file or key value must be supplied to SSH Key Value. ' - 'You can use --generate-ssh-keys to let CLI generate one for you') - return content - - -def _validate_vm_vmss_msi(cmd, namespace, is_identity_assign=False): - # For the creation of VM and VMSS, "--role" and "--scope" should be passed in at the same time - # when assigning a role to the managed identity - if not is_identity_assign and namespace.assign_identity is not None: - if (namespace.identity_scope and not namespace.identity_role) or \ - (not namespace.identity_scope and namespace.identity_role): - raise ArgumentUsageError( - "usage error: please specify both --role and --scope when assigning a role to the managed identity") - - # For "az vm/vmss identity assign", "--role" and "--scope" should be passed in at the same time - # when assigning a role to the managed identity - if is_identity_assign: - if (namespace.identity_scope and not namespace.identity_role) or \ - (not namespace.identity_scope and namespace.identity_role): - raise ArgumentUsageError( - "usage error: please specify both --role and --scope when assigning a role to the managed identity") - - # Assign managed identity - if is_identity_assign or namespace.assign_identity is not None: - identities = namespace.assign_identity or [] - from ._vm_utils import MSI_LOCAL_ID - for i, _ in enumerate(identities): - if identities[i] != MSI_LOCAL_ID: - identities[i] = _get_resource_id(cmd.cli_ctx, identities[i], namespace.resource_group_name, - 'userAssignedIdentities', 'Microsoft.ManagedIdentity') - - user_assigned_identities = [x for x in identities if x != MSI_LOCAL_ID] - if user_assigned_identities and not cmd.supported_api_version(min_api='2017-12-01'): - raise ArgumentUsageError('usage error: user assigned identity is only available under profile ' - 'with minimum Compute API version of 2017-12-01') - if namespace.identity_scope: - if identities and MSI_LOCAL_ID not in identities: - raise ArgumentUsageError("usage error: '--scope'/'--role' is only applicable when " - "assign system identity") - # keep 'identity_role' for output as logical name is more readable - setattr(namespace, 'identity_role_id', _resolve_role_id(cmd.cli_ctx, namespace.identity_role, - namespace.identity_scope)) - elif namespace.identity_scope or namespace.identity_role: - raise ArgumentUsageError('usage error: --assign-identity [--scope SCOPE] [--role ROLE]') - - if not is_identity_assign: - _enable_msi_for_trusted_launch(namespace) - - -def _enable_msi_for_trusted_launch(namespace): - # Enable system assigned msi by default when Trusted Launch configuration is met - is_trusted_launch = namespace.security_type and namespace.security_type.lower() == 'trustedlaunch' \ - and namespace.enable_vtpm and namespace.enable_secure_boot - if is_trusted_launch and namespace.enable_integrity_monitoring: - from ._vm_utils import MSI_LOCAL_ID - logger.info('The MSI is enabled by default when Trusted Launch configuration is met') - if namespace.assign_identity is None: - namespace.assign_identity = [MSI_LOCAL_ID] - elif '[system]' not in namespace.assign_identity: - namespace.assign_identity.append(MSI_LOCAL_ID) - - -def _validate_trusted_launch(namespace): - if not namespace.security_type or namespace.security_type.lower() != 'trustedlaunch': - return - - if namespace.enable_vtpm is None: - namespace.enable_vtpm = True - - if namespace.enable_secure_boot is None: - namespace.enable_secure_boot = True - - -def trusted_launch_set_default(namespace, generation_version, features): - if not generation_version: - return - - trusted_launch = ["TrustedLaunchSupported", "TrustedLaunchAndConfidentialVmSupported"] - - features_security_type = None - for item in features: - if hasattr(item, 'name') and hasattr(item, 'value') and item.name == 'SecurityType': - features_security_type = item.value - break - - from ._constants import UPGRADE_SECURITY_HINT, COMPATIBLE_SECURITY_TYPE_VALUE - if generation_version == 'V1': - logger.warning(UPGRADE_SECURITY_HINT) - - elif generation_version == 'V2': - if features_security_type in trusted_launch: - if namespace.security_type is None: - namespace.security_type = 'TrustedLaunch' - - if namespace.security_type != COMPATIBLE_SECURITY_TYPE_VALUE: - if namespace.enable_vtpm is None: - namespace.enable_vtpm = True - - if namespace.enable_secure_boot is None: - namespace.enable_secure_boot = True - else: - if namespace.security_type is None: - namespace.security_type = COMPATIBLE_SECURITY_TYPE_VALUE - logger.warning(UPGRADE_SECURITY_HINT) - - -def _validate_generation_version_and_trusted_launch(cmd, namespace): - from azure.cli.core.profiles import ResourceType - if not cmd.supported_api_version(resource_type=ResourceType.MGMT_COMPUTE, min_api='2020-12-01'): - return - from ._vm_utils import validate_image_trusted_launch, validate_vm_disk_trusted_launch - if namespace.image is not None: - from ._vm_utils import is_valid_image_version_id - if is_valid_image_version_id(namespace.image): - if namespace.security_type is None: - namespace.security_type = 'Standard' - - image_type = _parse_image_argument(cmd, namespace) - - if image_type == 'image_id': - # managed image does not support trusted launch - validate_image_trusted_launch(namespace) - return - - if image_type == 'uri': - # vhd does not support trusted launch - return - - if image_type == 'shared_gallery_image_id': - validate_image_trusted_launch(namespace) - return - - if image_type == 'community_gallery_image_id': - validate_image_trusted_launch(namespace) - return - - if image_type == 'urn': - client = _compute_client_factory(cmd.cli_ctx).virtual_machine_images - os_version = namespace.os_version - if os_version.lower() == 'latest': - os_version = _get_latest_image_version(cmd.cli_ctx, namespace.location, namespace.os_publisher, - namespace.os_offer, namespace.os_sku) - vm_image_info = client.get(namespace.location, namespace.os_publisher, namespace.os_offer, - namespace.os_sku, os_version) - generation_version = vm_image_info.hyper_v_generation if hasattr(vm_image_info, - 'hyper_v_generation') else None - features = vm_image_info.features if hasattr(vm_image_info, 'features') and vm_image_info.features else [] - - trusted_launch_set_default(namespace, generation_version, features) - return - - # create vm with os disk - if hasattr(namespace, 'attach_os_disk') and namespace.attach_os_disk is not None: - from azure.mgmt.core.tools import parse_resource_id - if urlparse(namespace.attach_os_disk).scheme and "://" in namespace.attach_os_disk: - # vhd does not support trusted launch - return - client = _compute_client_factory(cmd.cli_ctx).disks - attach_os_disk_name = parse_resource_id(namespace.attach_os_disk)['name'] - attach_os_disk_info = client.get(namespace.resource_group_name, attach_os_disk_name) - disk_security_profile = attach_os_disk_info.security_profile if hasattr(attach_os_disk_info, - 'security_profile') else None - validate_vm_disk_trusted_launch(namespace, disk_security_profile) - - -def _validate_vm_vmss_set_applications(cmd, namespace): # pylint: disable=unused-argument - if namespace.application_configuration_overrides and \ - len(namespace.application_version_ids) != len(namespace.application_configuration_overrides): - raise ArgumentUsageError('usage error: --app-config-overrides should have the same number of items as' - ' --application-version-ids') - if namespace.treat_deployment_as_failure: - if len(namespace.application_version_ids) != len(namespace.treat_deployment_as_failure): - raise ArgumentUsageError('usage error: --treat-deployment-as-failure should have the same number of items' - ' as --application-version-ids') - for boolean_value_in_string in namespace.treat_deployment_as_failure: - if boolean_value_in_string.lower() != 'true' and boolean_value_in_string.lower() != 'false': - raise ArgumentUsageError('usage error: --treat-deployment-as-failure only accepts a list of "true" or' - ' "false" values') - - -def _resolve_role_id(cli_ctx, role, scope): - import re - import uuid - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.cli.core.profiles import ResourceType - client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_AUTHORIZATION).role_definitions - - role_id = None - if re.match(r'/subscriptions/.+/providers/Microsoft.Authorization/roleDefinitions/', - role, re.I): - role_id = role - else: - try: - uuid.UUID(role) - role_id = '/subscriptions/{}/providers/Microsoft.Authorization/roleDefinitions/{}'.format( - client.config.subscription_id, role) - except ValueError: - pass - if not role_id: # retrieve role id - role_defs = list(client.list(scope, "roleName eq '{}'".format(role))) - if not role_defs: - raise CLIError("Role '{}' doesn't exist.".format(role)) - if len(role_defs) > 1: - ids = [r.id for r in role_defs] - err = "More than one role matches the given name '{}'. Please pick an id from '{}'" - raise CLIError(err.format(role, ids)) - role_id = role_defs[0].id - return role_id - - -def process_vm_create_namespace(cmd, namespace): - validate_tags(namespace) - _validate_location(cmd, namespace, namespace.zone, namespace.size) - - # Currently, only `az vm create` supports this feature, so it is temporarily placed in process_vm_create_namespace() - from ._vm_utils import display_region_recommendation - display_region_recommendation(cmd, namespace) - - validate_edge_zone(cmd, namespace) - if namespace.count is not None: - _validate_count(namespace) - validate_asg_names_or_ids(cmd, namespace) - _validate_vm_create_storage_profile(cmd, namespace) - if namespace.storage_profile in [StorageProfile.SACustomImage, - StorageProfile.SAPirImage]: - _validate_vm_create_storage_account(cmd, namespace) - - _validate_vm_create_availability_set(cmd, namespace) - _validate_vm_create_vmss(cmd, namespace) - _validate_vm_vmss_create_vnet(cmd, namespace) - _validate_vm_create_nsg(cmd, namespace) - _validate_vm_vmss_create_public_ip(cmd, namespace) - _validate_vm_create_nics(cmd, namespace) - _validate_vm_vmss_accelerated_networking(cmd.cli_ctx, namespace) - _validate_vm_vmss_create_auth(namespace, cmd) - - _validate_proximity_placement_group(cmd, namespace) - _validate_vm_create_dedicated_host(cmd, namespace) - - if namespace.secrets: - _validate_secrets(namespace.secrets, namespace.os_type) - _validate_trusted_launch(namespace) - _validate_vm_vmss_msi(cmd, namespace) - _validate_generation_version_and_trusted_launch(cmd, namespace) - if namespace.boot_diagnostics_storage: - namespace.boot_diagnostics_storage = get_storage_blob_uri(cmd.cli_ctx, namespace.boot_diagnostics_storage) - - _validate_capacity_reservation_group(cmd, namespace) - _validate_vm_nic_delete_option(namespace) - _validate_community_gallery_legal_agreement_acceptance(cmd, namespace) - - -# endregion - - -def process_vm_update_namespace(cmd, namespace): - _validate_vm_create_dedicated_host(cmd, namespace) - _validate_capacity_reservation_group(cmd, namespace) - _validate_vm_vmss_update_ephemeral_placement(cmd, namespace) - - -# region VMSS Create Validators -def _get_default_address_pool(cli_ctx, resource_group, balancer_name, balancer_type): - option_name = '--backend-pool-name' - - if balancer_type == 'application_gateways': - client = import_aaz_by_profile(cli_ctx.cloud.profile, "network.application_gateway") - elif balancer_type == 'load_balancers': - client = import_aaz_by_profile(cli_ctx.cloud.profile, "network.lb") - else: - raise CLIError('unrecognized balancer type: {}'.format(balancer_type)) - - balancer = client.Show(cli_ctx=cli_ctx)(command_args={ - 'name': balancer_name, - 'resource_group': resource_group - }) - values = [x['name'] for x in balancer['backendAddressPools']] - if len(values) > 1: - raise CLIError("Multiple possible values found for '{0}': {1}\nSpecify '{0}' " - "explicitly.".format(option_name, ', '.join(values))) - if not values: - raise CLIError("No existing values found for '{0}'. Create one first and try " - "again.".format(option_name)) - return values[0] - - -# Client end hack per: https://github.com/Azure/azure-cli/issues/9943 -def _validate_vmss_single_placement_group(namespace): - if namespace.zones or namespace.instance_count > 100: - if namespace.single_placement_group is None: - namespace.single_placement_group = False - - -def _validate_vmss_create_load_balancer_or_app_gateway(cmd, namespace): - from azure.mgmt.core.tools import parse_resource_id - from azure.cli.core.profiles import ResourceType - from azure.core.exceptions import HttpResponseError - std_lb_is_available = cmd.supported_api_version(min_api='2017-08-01', resource_type=ResourceType.MGMT_NETWORK) - - if namespace.load_balancer and namespace.application_gateway: - raise CLIError('incorrect usage: --load-balancer NAME_OR_ID | ' - '--application-gateway NAME_OR_ID') - - # Resolve the type of balancer (if any) being used - balancer_type = 'None' - if namespace.load_balancer is None and namespace.application_gateway is None: - if std_lb_is_available: - balancer_type = 'loadBalancer' - else: # needed for Stack profile 2017_03_09 - balancer_type = 'loadBalancer' if namespace.single_placement_group is not False else 'applicationGateway' - logger.debug("W/o STD LB, defaulting to '%s' under because single placement group is disabled", - balancer_type) - - elif namespace.load_balancer: - balancer_type = 'loadBalancer' - elif namespace.application_gateway: - balancer_type = 'applicationGateway' - - if balancer_type == 'applicationGateway': - - if namespace.application_gateway: - client = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.application_gateway") - try: - rg = parse_resource_id(namespace.application_gateway).get( - 'resource_group', namespace.resource_group_name) - ag_name = parse_resource_id(namespace.application_gateway)['name'] - client.Show(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': ag_name, - 'resource_group': rg - }) - namespace.app_gateway_type = 'existing' - namespace.backend_pool_name = namespace.backend_pool_name or \ - _get_default_address_pool(cmd.cli_ctx, rg, ag_name, 'application_gateways') - logger.debug("using specified existing application gateway '%s'", namespace.application_gateway) - except HttpResponseError: - namespace.app_gateway_type = 'new' - logger.debug("application gateway '%s' not found. It will be created.", namespace.application_gateway) - elif namespace.application_gateway == '': - namespace.app_gateway_type = None - logger.debug('no application gateway will be used') - elif namespace.application_gateway is None: - namespace.app_gateway_type = 'new' - logger.debug('new application gateway will be created') - - # AppGateway frontend - required = [] - if namespace.app_gateway_type == 'new': - required.append('app_gateway_sku') - required.append('app_gateway_capacity') - if namespace.vnet_type != 'new': - required.append('app_gateway_subnet_address_prefix') - elif namespace.app_gateway_type == 'existing': - required.append('backend_pool_name') - forbidden = ['nat_pool_name', 'load_balancer', 'health_probe'] - validate_parameter_set(namespace, required, forbidden, description='network balancer: application gateway') - - elif balancer_type == 'loadBalancer': - # LoadBalancer frontend - required = [] - forbidden = ['app_gateway_subnet_address_prefix', 'application_gateway', 'app_gateway_sku', - 'app_gateway_capacity'] - validate_parameter_set(namespace, required, forbidden, description='network balancer: load balancer') - - if namespace.load_balancer: - rg = parse_resource_id(namespace.load_balancer).get('resource_group', namespace.resource_group_name) - lb_name = parse_resource_id(namespace.load_balancer)['name'] - lb = get_network_lb(cmd.cli_ctx, namespace.resource_group_name, lb_name) - if lb: - namespace.load_balancer_type = 'existing' - namespace.backend_pool_name = namespace.backend_pool_name or \ - _get_default_address_pool(cmd.cli_ctx, rg, lb_name, 'load_balancers') - if not namespace.nat_pool_name: - if len(lb['inboundNatPools']) > 1: - raise CLIError( - "Multiple possible values found for '{0}': {1}\nSpecify '{0}' explicitly.".format( - # pylint: disable=line-too-long - '--nat-pool-name', ', '.join([n['name'] for n in lb['inboundNatPools']]))) - if lb['inboundNatPools']: - namespace.nat_pool_name = lb['inboundNatPools'][0]['name'] - logger.debug("using specified existing load balancer '%s'", namespace.load_balancer) - else: - namespace.load_balancer_type = 'new' - logger.debug("load balancer '%s' not found. It will be created.", namespace.load_balancer) - elif namespace.load_balancer == '': - namespace.load_balancer_type = None - logger.debug('no load balancer will be used') - elif namespace.load_balancer is None: - namespace.load_balancer_type = 'new' - logger.debug('new load balancer will be created') - - if namespace.load_balancer_type == 'new' and namespace.single_placement_group is False and std_lb_is_available: - if namespace.load_balancer_sku is None: - namespace.load_balancer_sku = 'Standard' - logger.debug("use Standard sku as single placement group is turned off") - elif namespace.load_balancer_sku == 'Basic': - if namespace.zones: - err = "'Standard' load balancer is required for zonal scale-sets" - elif namespace.instance_count > 100: - err = "'Standard' load balancer is required for scale-sets with 100+ instances" - else: - err = "'Standard' load balancer is required because 'single placement group' is turned off" - - raise CLIError('usage error:{}'.format(err)) - - -def get_network_lb(cli_ctx, resource_group_name, lb_name): - from azure.core.exceptions import HttpResponseError - LBShow = import_aaz_by_profile(cli_ctx.cloud.profile, "network.lb").Show - try: - return LBShow(cli_ctx=cli_ctx)({ - "name": lb_name, - "resource_group": resource_group_name - }) - except HttpResponseError: - return None - - -def process_vmss_create_namespace(cmd, namespace): - from azure.cli.core.azclierror import InvalidArgumentValueError - flexible_str = 'Flexible' - - if namespace.os_disk_delete_option is not None or namespace.data_disk_delete_option is not None: - if namespace.orchestration_mode.lower() != flexible_str.lower(): - raise InvalidArgumentValueError('usage error: --os-disk-delete-option/--data-disk-delete-option is only' - ' available for VMSS with flexible orchestration mode') - - if namespace.regular_priority_count is not None or namespace.regular_priority_percentage is not None: - if namespace.orchestration_mode.lower() != flexible_str.lower(): - raise InvalidArgumentValueError('usage error: --regular-priority-count/--regular-priority-percentage is' - ' only available for VMSS with flexible orchestration mode') - - if namespace.orchestration_mode.lower() == flexible_str.lower(): - - # The commentted parameters are also forbidden, but they have default values. - # I don't know whether they are provided by user. - - namespace.load_balancer_sku = 'Standard' # lb sku MUST be standard - # namespace.public_ip_per_vm = True # default to true for VMSS Flex - - namespace.use_unmanaged_disk = None - - banned_params = { - '--disable-overprovision': namespace.disable_overprovision, - '--health-probe': namespace.health_probe, - '--host-group': namespace.host_group, - '--nat-pool-name': namespace.nat_pool_name, - '--scale-in-policy': namespace.scale_in_policy, - '--user-data': namespace.user_data - } - - for param, value in banned_params.items(): - if value is not None: - raise ArgumentUsageError(f'usage error: {param} is not supported for Flex mode') - - if namespace.vm_sku and not namespace.image: - raise ArgumentUsageError('usage error: please specify the --image when you want to specify the VM SKU') - - _validate_trusted_launch(namespace) - if namespace.image: - - if namespace.vm_sku is None: - from azure.cli.core.cloud import AZURE_US_GOV_CLOUD - if cmd.cli_ctx.cloud.name != AZURE_US_GOV_CLOUD.name: - namespace.vm_sku = 'Standard_DS1_v2' - else: - namespace.vm_sku = 'Standard_D1_v2' - - if namespace.network_api_version is None: - namespace.network_api_version = '2020-11-01' - - if namespace.platform_fault_domain_count is None: - namespace.platform_fault_domain_count = 1 - - if namespace.computer_name_prefix is None: - namespace.computer_name_prefix = namespace.vmss_name[:8] - - # if namespace.platform_fault_domain_count is None: - # raise CLIError("usage error: --platform-fault-domain-count is required in Flexible mode") - - if namespace.tags is not None: - validate_tags(namespace) - _validate_location(cmd, namespace, namespace.zones, namespace.vm_sku) - validate_edge_zone(cmd, namespace) - if namespace.application_security_groups is not None: - validate_asg_names_or_ids(cmd, namespace) - - if getattr(namespace, 'attach_os_disk', None) or namespace.image is not None: - _validate_vm_create_storage_profile(cmd, namespace, for_scale_set=True) - - if namespace.vnet_name or namespace.subnet or namespace.image: - _validate_vm_vmss_create_vnet(cmd, namespace, for_scale_set=True) - _validate_vmss_create_subnet(namespace) - - if namespace.load_balancer or namespace.application_gateway or namespace.image: - _validate_vmss_create_load_balancer_or_app_gateway(cmd, namespace) - - if namespace.public_ip_address or namespace.image: - _validate_vmss_create_public_ip(cmd, namespace) - - if namespace.nsg is not None: - _validate_vmss_create_nsg(cmd, namespace) - if namespace.accelerated_networking is not None: - _validate_vm_vmss_accelerated_networking(cmd.cli_ctx, namespace) - if any([namespace.admin_password, namespace.ssh_dest_key_path, namespace.generate_ssh_keys, - namespace.authentication_type, namespace.os_type]): - _validate_vm_vmss_create_auth(namespace, cmd) - if namespace.assign_identity == '[system]': - raise InvalidArgumentValueError('usage error: only user assigned indetity is suppoprted for Flex mode.') - if namespace.assign_identity is not None: - _validate_vm_vmss_msi(cmd, namespace) # -- UserAssignedOnly - _validate_proximity_placement_group(cmd, namespace) - _validate_vmss_terminate_notification(cmd, namespace) - if namespace.automatic_repairs_grace_period is not None: - _validate_vmss_create_automatic_repairs(cmd, namespace) - _validate_vmss_create_host_group(cmd, namespace) - - if namespace.secrets is not None: - _validate_secrets(namespace.secrets, namespace.os_type) - - if namespace.eviction_policy and not namespace.priority: - raise ArgumentUsageError('usage error: --priority PRIORITY [--eviction-policy POLICY]') - - return - - # Uniform mode - if namespace.disable_overprovision is None: - namespace.disable_overprovision = False - validate_tags(namespace) - if namespace.vm_sku is None: - from azure.cli.core.cloud import AZURE_US_GOV_CLOUD - if cmd.cli_ctx.cloud.name != AZURE_US_GOV_CLOUD.name: - namespace.vm_sku = 'Standard_DS1_v2' - else: - namespace.vm_sku = 'Standard_D1_v2' - _validate_location(cmd, namespace, namespace.zones, namespace.vm_sku) - validate_edge_zone(cmd, namespace) - validate_asg_names_or_ids(cmd, namespace) - _validate_vm_create_storage_profile(cmd, namespace, for_scale_set=True) - _validate_vm_vmss_create_vnet(cmd, namespace, for_scale_set=True) - - _validate_vmss_single_placement_group(namespace) - _validate_vmss_create_load_balancer_or_app_gateway(cmd, namespace) - _validate_vmss_create_subnet(namespace) - _validate_vmss_create_public_ip(cmd, namespace) - _validate_vmss_create_nsg(cmd, namespace) - _validate_vm_vmss_accelerated_networking(cmd.cli_ctx, namespace) - _validate_vm_vmss_create_auth(namespace, cmd) - _validate_trusted_launch(namespace) - _validate_vm_vmss_msi(cmd, namespace) - _validate_generation_version_and_trusted_launch(cmd, namespace) - _validate_proximity_placement_group(cmd, namespace) - _validate_vmss_terminate_notification(cmd, namespace) - _validate_vmss_create_automatic_repairs(cmd, namespace) - _validate_vmss_create_host_group(cmd, namespace) - - if namespace.secrets: - _validate_secrets(namespace.secrets, namespace.os_type) - - if not namespace.public_ip_per_vm and namespace.vm_domain_name: - raise ArgumentUsageError('usage error: --vm-domain-name can only be used when --public-ip-per-vm is enabled') - - if namespace.eviction_policy and not namespace.priority: - raise ArgumentUsageError('usage error: --priority PRIORITY [--eviction-policy POLICY]') - - _validate_capacity_reservation_group(cmd, namespace) - _validate_community_gallery_legal_agreement_acceptance(cmd, namespace) - - -def validate_vmss_update_namespace(cmd, namespace): # pylint: disable=unused-argument - if not namespace.instance_id: - if namespace.protect_from_scale_in is not None or namespace.protect_from_scale_set_actions is not None: - raise CLIError("usage error: protection policies can only be applied to VM instances within a VMSS." - " Please use --instance-id to specify a VM instance") - _validate_vmss_update_terminate_notification_related(cmd, namespace) - _validate_vmss_update_automatic_repairs(cmd, namespace) - _validate_capacity_reservation_group(cmd, namespace) - _validate_vm_vmss_update_ephemeral_placement(cmd, namespace) - - -# endregion - - -# region disk, snapshot, image validators -def process_vm_disk_attach_namespace(cmd, namespace): - if not namespace.disks and not namespace.disk and not namespace.disk_ids: - raise RequiredArgumentMissingError("Please use at least one of --name, --disks and --disk-ids") - - if namespace.disk and namespace.disks: - raise MutuallyExclusiveArgumentError("You can only specify one of --name and --disks") - - if namespace.disk and namespace.disk_ids: - raise MutuallyExclusiveArgumentError("You can only specify one of --name and --disk-ids") - - if namespace.disks and namespace.disk_ids: - raise MutuallyExclusiveArgumentError("You can only specify one of --disks and --disk-ids") - - disks = [] - if namespace.disk: - disks = [_get_resource_id(cmd.cli_ctx, namespace.disk, namespace.resource_group_name, - 'disks', 'Microsoft.Compute')] - if namespace.disks: - for disk in namespace.disks: - disks.append(_get_resource_id(cmd.cli_ctx, disk, namespace.resource_group_name, - 'disks', 'Microsoft.Compute')) - namespace.disks = disks - - if len(disks) > 1 and namespace.lun: - raise MutuallyExclusiveArgumentError("You cannot specify the --lun for multiple disks") - - if namespace.disk_ids and len(namespace.disk_ids) > 1 and namespace.lun: - raise MutuallyExclusiveArgumentError("You cannot specify the --lun for multiple disk IDs") - - -def process_vm_disk_detach_namespace(namespace): - if not namespace.disk_name and not namespace.disk_ids: - raise RequiredArgumentMissingError("Please use at least one '--name', '--disk-ids'") - - -def validate_vmss_disk(cmd, namespace): - if namespace.disk: - namespace.disk = _get_resource_id(cmd.cli_ctx, namespace.disk, - namespace.resource_group_name, 'disks', 'Microsoft.Compute') - if bool(namespace.disk) == bool(namespace.size_gb): - raise CLIError('usage error: --disk EXIST_DISK --instance-id ID | --size-gb GB') - if bool(namespace.disk) != bool(namespace.instance_id): - raise CLIError('usage error: --disk EXIST_DISK --instance-id ID') - - -def _validate_gallery_image_reference(cmd, namespace): - from azure.cli.core.profiles import ResourceType - is_validate = 'gallery_image_reference' in namespace and namespace.gallery_image_reference is not None \ - and cmd.supported_api_version(resource_type=ResourceType.MGMT_COMPUTE, - operation_group='disks', min_api='2022-03-02') - if not is_validate: - return - - from azure.cli.command_modules.vm.azure_stack._image_builder import GalleryImageReferenceType - from ._vm_utils import is_compute_gallery_image_id, is_community_gallery_image_id, \ - is_shared_gallery_image_id - - gallery_image_reference = namespace.gallery_image_reference - if is_compute_gallery_image_id(gallery_image_reference): - namespace.gallery_image_reference_type = GalleryImageReferenceType.COMPUTE.backend_key - return - if is_community_gallery_image_id(gallery_image_reference): - namespace.gallery_image_reference_type = GalleryImageReferenceType.COMMUNITY.backend_key - return - if is_shared_gallery_image_id(gallery_image_reference): - namespace.gallery_image_reference_type = GalleryImageReferenceType.SHARED.backend_key - return - - from azure.cli.core.parser import InvalidArgumentValueError - raise InvalidArgumentValueError('usage error: {} is an invalid gallery image reference, please provide valid ' - 'compute, shared or community gallery image version. For details about valid ' - 'format, please refer to the help sample'.format(gallery_image_reference)) - - -def process_disk_create_namespace(cmd, namespace): - from azure.core.exceptions import HttpResponseError - validate_tags(namespace) - validate_edge_zone(cmd, namespace) - _validate_gallery_image_reference(cmd, namespace) - _validate_security_data_uri(namespace) - _validate_upload_type(cmd, namespace) - _validate_secure_vm_disk_encryption_set(namespace) - _validate_hyper_v_generation(namespace) - if namespace.source: - usage_error = 'usage error: --source {SNAPSHOT | DISK | RESTOREPOINT} | ' \ - '--source VHD_BLOB_URI [--source-storage-account-id ID]' - try: - namespace.source_blob_uri, namespace.source_disk, namespace.source_snapshot, \ - namespace.source_restore_point, _ = _figure_out_storage_source( - cmd.cli_ctx, namespace.resource_group_name, namespace.source) - if not namespace.source_blob_uri and namespace.source_storage_account_id: - raise ArgumentUsageError(usage_error) - except HttpResponseError: - raise ArgumentUsageError(usage_error) - - -def _validate_security_data_uri(namespace): - if 'security_data_uri' not in namespace or not namespace.security_data_uri: - return - - if not namespace.security_type: - raise RequiredArgumentMissingError( - 'Please specify --security-type when using the --security-data-uri parameter') - - if not namespace.hyper_v_generation or namespace.hyper_v_generation != 'V2': - raise ArgumentUsageError( - "Please specify --hyper-v-generation as 'V2' when using the --security-data-uri parameter") - - if not namespace.source: - raise RequiredArgumentMissingError( - 'Please specify --source when using the --security-data-uri parameter') - - -def _validate_upload_type(cmd, namespace): - if 'upload_type' not in namespace: - return - - if not namespace.upload_type and namespace.for_upload: - namespace.upload_type = 'Upload' - - if namespace.upload_type == 'UploadWithSecurityData': - - if not cmd.supported_api_version(min_api='2021-08-01', operation_group='disks'): - raise ArgumentUsageError( - "'UploadWithSecurityData' is not supported in the current profile. " - "Please upgrade your profile with 'az cloud set --profile newerProfile' and try again") - - if not namespace.security_type: - raise RequiredArgumentMissingError( - "Please specify --security-type when the value of --upload-type is 'UploadWithSecurityData'") - - if not namespace.hyper_v_generation or namespace.hyper_v_generation != 'V2': - raise ArgumentUsageError( - "Please specify --hyper-v-generation as 'V2' the value of --upload-type is 'UploadWithSecurityData'") - - -def _validate_secure_vm_disk_encryption_set(namespace): - if 'secure_vm_disk_encryption_set' not in namespace: - return - - if namespace.secure_vm_disk_encryption_set: - if not namespace.security_type or \ - namespace.security_type.lower() != 'confidentialvm_diskencryptedwithcustomerkey': - raise ArgumentUsageError('usage error: --secure-vm-disk-encryption-set can only be specified only ' - 'when --security-type is set to ConfidentialVM_DiskEncryptedWithCustomerKey') - - elif namespace.security_type and namespace.security_type.lower() == 'confidentialvm_diskencryptedwithcustomerkey': - raise ArgumentUsageError('usage error: --secure-vm-disk-encryption-set is mandatory when ' - '--security-type is set to ConfidentialVM_DiskEncryptedWithCustomerKey') - - -def _validate_hyper_v_generation(namespace): - if namespace.security_type and (not namespace.hyper_v_generation or namespace.hyper_v_generation == 'V1'): - logger.warning( - 'Enabling security features by using parameter "--security-type" requires UEFI support with Generation 2 ' - 'VMs, please set the parameter "--hyper-v-generation" to "V2" for enabling Generation 2 VM support.') - - -def process_snapshot_create_namespace(cmd, namespace): - from azure.core.exceptions import HttpResponseError - validate_tags(namespace) - validate_edge_zone(cmd, namespace) - _validate_gallery_image_reference(cmd, namespace) - if namespace.source: - usage_error = 'usage error: --source {SNAPSHOT | DISK} | --source VHD_BLOB_URI [--source-storage-account-id ID]' - try: - namespace.source_blob_uri, namespace.source_disk, namespace.source_snapshot, _, source_info = \ - _figure_out_storage_source(cmd.cli_ctx, namespace.resource_group_name, namespace.source) - if not namespace.source_blob_uri and namespace.source_storage_account_id: - raise ArgumentUsageError(usage_error) - # autodetect copy_start for `az snapshot create` - if 'snapshot create' in cmd.name and hasattr(namespace, 'copy_start') and namespace.copy_start is None: - if not source_info: - from azure.cli.core.util import parse_proxy_resource_id - result = parse_proxy_resource_id(namespace.source_disk or namespace.source_snapshot) - try: - source_info, _ = _get_disk_or_snapshot_info(cmd.cli_ctx, - result['resource_group'], - result['name']) - except Exception: # pylint: disable=broad-except - # There's a chance that the source doesn't exist, eg, vmss os disk. - # You can get the id of vmss os disk by - # `az vmss show -g {} -n {} --instance-id {} --query storageProfile.osDisk.managedDisk.id` - # But `az disk show --ids {}` will return ResourceNotFound error - # We don't autodetect copy_start in this situation - return - if not namespace.location: - get_default_location_from_resource_group(cmd, namespace) - # if the source location differs from target location, then it's copy_start scenario - if namespace.incremental: - namespace.copy_start = source_info.location != namespace.location - except HttpResponseError: - raise ArgumentUsageError(usage_error) - - -def process_image_create_namespace(cmd, namespace): - from azure.mgmt.core.tools import parse_resource_id - validate_tags(namespace) - validate_edge_zone(cmd, namespace) - source_from_vm = False - try: - # try capturing from VM, a most common scenario - res_id = _get_resource_id(cmd.cli_ctx, namespace.source, namespace.resource_group_name, - 'virtualMachines', 'Microsoft.Compute') - res = parse_resource_id(res_id) - if res['type'] == 'virtualMachines': - compute_client = _compute_client_factory(cmd.cli_ctx, subscription_id=res['subscription']) - vm_info = compute_client.virtual_machines.get(res['resource_group'], res['name']) - source_from_vm = True - except ResourceNotFoundError: - pass - - if source_from_vm: - # pylint: disable=no-member - namespace.os_type = vm_info.storage_profile.os_disk.os_type - namespace.source_virtual_machine = res_id - if namespace.data_disk_sources: - raise CLIError("'--data-disk-sources' is not allowed when capturing " - "images from virtual machines") - else: - # pylint: disable=line-too-long - namespace.os_blob_uri, namespace.os_disk, namespace.os_snapshot, _, _ = _figure_out_storage_source(cmd.cli_ctx, - namespace.resource_group_name, - namespace.source) - namespace.data_blob_uris = [] - namespace.data_disks = [] - namespace.data_snapshots = [] - if namespace.data_disk_sources: - for data_disk_source in namespace.data_disk_sources: - source_blob_uri, source_disk, source_snapshot, _, _ = _figure_out_storage_source( - cmd.cli_ctx, namespace.resource_group_name, data_disk_source) - if source_blob_uri: - namespace.data_blob_uris.append(source_blob_uri) - if source_disk: - namespace.data_disks.append(source_disk) - if source_snapshot: - namespace.data_snapshots.append(source_snapshot) - if not namespace.os_type: - raise CLIError("usage error: os type is required to create the image, " - "please specify '--os-type OS_TYPE'") - - -def _figure_out_storage_source(cli_ctx, resource_group_name, source): - source_blob_uri = None - source_disk = None - source_snapshot = None - source_info = None - source_restore_point = None - if urlparse(source).scheme: # a uri? - source_blob_uri = source - elif '/disks/' in source.lower(): - source_disk = source - elif '/snapshots/' in source.lower(): - source_snapshot = source - elif '/restorepoints/' in source.lower(): - source_restore_point = source - else: - source_info, is_snapshot = _get_disk_or_snapshot_info(cli_ctx, resource_group_name, source) - if is_snapshot: - source_snapshot = source_info.id - else: - source_disk = source_info.id - - return (source_blob_uri, source_disk, source_snapshot, source_restore_point, source_info) - - -def _get_disk_or_snapshot_info(cli_ctx, resource_group_name, source): - compute_client = _compute_client_factory(cli_ctx) - is_snapshot = True - - try: - info = compute_client.snapshots.get(resource_group_name, source) - except ResourceNotFoundError: - is_snapshot = False - info = compute_client.disks.get(resource_group_name, source) - - return info, is_snapshot - - -def process_disk_encryption_namespace(cmd, namespace): - namespace.disk_encryption_keyvault = _get_resource_id(cmd.cli_ctx, namespace.disk_encryption_keyvault, - namespace.resource_group_name, - 'vaults', 'Microsoft.KeyVault') - - if namespace.key_encryption_keyvault: - if not namespace.key_encryption_key: - raise CLIError("Incorrect usage '--key-encryption-keyvault': " - "'--key-encryption-key' is required") - namespace.key_encryption_keyvault = _get_resource_id(cmd.cli_ctx, namespace.key_encryption_keyvault, - namespace.resource_group_name, - 'vaults', 'Microsoft.KeyVault') - - -def process_assign_identity_namespace(cmd, namespace): - _validate_vm_vmss_msi(cmd, namespace, is_identity_assign=True) - - -def process_remove_identity_namespace(cmd, namespace): - if namespace.identities: - from ._vm_utils import MSI_LOCAL_ID - for i, identity in enumerate(namespace.identities): - if identity != MSI_LOCAL_ID: - namespace.identities[i] = _get_resource_id(cmd.cli_ctx, identity, - namespace.resource_group_name, - 'userAssignedIdentities', - 'Microsoft.ManagedIdentity') - - -def process_set_applications_namespace(cmd, namespace): # pylint: disable=unused-argument - _validate_vm_vmss_set_applications(cmd, namespace) - - -def process_gallery_image_version_namespace(cmd, namespace): - from azure.cli.core.azclierror import InvalidArgumentValueError - - if namespace.target_regions: - if hasattr(namespace, 'target_region_encryption') and namespace.target_region_encryption: - if len(namespace.target_regions) != len(namespace.target_region_encryption): - raise InvalidArgumentValueError( - 'usage error: Length of --target-region-encryption should be as same as length of target regions') - - storage_account_types_list = [item.lower() for item in ['Standard_LRS', 'Standard_ZRS', 'Premium_LRS']] - storage_account_types_str = ", ".join(storage_account_types_list) - - regions_info = [] - for i, t in enumerate(namespace.target_regions): - parts = t.split('=', 2) - replica_count = None - storage_account_type = None - - # Region specified, but also replica count or storage account type - if len(parts) == 2: - try: - replica_count = int(parts[1]) - except ValueError: - storage_account_type = parts[1] - if parts[1].lower() not in storage_account_types_list: - raise ArgumentUsageError( - "usage error: {} is an invalid target region argument. " - "The second part is neither an integer replica count or a valid storage account type. " - "Storage account types must be one of {}.".format(t, storage_account_types_str)) - - # Region specified, but also replica count and storage account type - elif len(parts) == 3: - try: - replica_count = int(parts[1]) # raises ValueError if this is not a replica count, try other order. - storage_account_type = parts[2] - if storage_account_type not in storage_account_types_list: - raise ArgumentUsageError( - "usage error: {} is an invalid target region argument. " - "The third part is not a valid storage account type. " - "Storage account types must be one of {}.".format(t, storage_account_types_str)) - except ValueError: - raise ArgumentUsageError( - "usage error: {} is an invalid target region argument. " - "The second part must be a valid integer replica count.".format(t)) - - # Parse target region encryption, example: ['des1,0,des2,1,des3', 'null', 'des4'] - encryption = None - os_disk_image = None - data_disk_images = None - if hasattr(namespace, 'target_region_encryption') and namespace.target_region_encryption: - terms = namespace.target_region_encryption[i].split(',') - # OS disk - os_disk_image = terms[0] - if os_disk_image == 'null': - os_disk_image = None - else: - des_id = _disk_encryption_set_format(cmd, namespace, os_disk_image) - os_disk_image = {"disk_encryption_set_id": des_id} - # Data disk - if len(terms) > 1: - data_disk_images = terms[1:] - data_disk_images_len = len(data_disk_images) - if data_disk_images_len % 2 != 0: - raise ArgumentUsageError( - 'usage error: LUN and disk encryption set for data disk should appear in pair in ' - '--target-region-encryption. Example: osdes,0,datades0,1,datades1') - data_disk_image_encryption_list = [] - for j in range(int(data_disk_images_len / 2)): - lun = data_disk_images[j * 2] - des_id = data_disk_images[j * 2 + 1] - des_id = _disk_encryption_set_format(cmd, namespace, des_id) - try: - data_disk_image_encryption_list.append({"lun": int(lun), "disk_encryption_set_id": des_id}) - except: - raise ArgumentUsageError( - "usage error: {} is an invalid target region encryption argument. " - "LUN and disk encryption set for data disk should appear in pair in " - "--target-region-encryption. Example: osdes,0,datades0,1,datades1" - ) - - data_disk_images = data_disk_image_encryption_list - - if os_disk_image or data_disk_images: - encryption = {"os_disk_image": os_disk_image, "data_disk_images": data_disk_images} - - # At least the region is specified - if len(parts) >= 1: - regions_info.append({"name": parts[0], - "regional_replica_count": replica_count, - "storage_account_type": storage_account_type, - "encryption": encryption}) - - namespace.target_regions = regions_info - - -def _disk_encryption_set_format(cmd, namespace, name): - """ - Transform name to ID. If it's already a valid ID, do nothing. - :param name: string - :return: ID - """ - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - if name is not None and not is_valid_resource_id(name): - name = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=namespace.resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=name) - return name -# endregion - - -def process_image_version_create_namespace(cmd, namespace): - validate_tags(namespace) - process_gallery_image_version_namespace(cmd, namespace) - process_image_resource_id_namespace(namespace) -# endregion - - -def process_image_version_update_namespace(cmd, namespace): - process_gallery_image_version_namespace(cmd, namespace) -# endregion - - -def process_image_version_undelete_namespace(cmd, namespace): # pylint: disable=unused-argument - validate_tags(namespace) - - -def process_image_resource_id_namespace(namespace): - """ - Validate the resource id from different sources - Only one of these arguments is allowed to provide - Check the format of resource id whether meets requirement - """ - input_num = (1 if namespace.managed_image else 0) + (1 if namespace.virtual_machine else 0) + \ - (1 if namespace.image_version else 0) - if input_num > 1: - raise MutuallyExclusiveArgumentError( - r'usage error: please specify only one of the --managed-image\--virtual-machine\--image-version arguments') - - if namespace.managed_image or input_num == 0: - return - - from ._vm_utils import is_valid_vm_resource_id, is_valid_image_version_id - is_vm = namespace.virtual_machine is not None - is_valid_function = is_valid_vm_resource_id if is_vm else is_valid_image_version_id - resource_id = namespace.virtual_machine if is_vm else namespace.image_version - - if not is_valid_function(resource_id): - from azure.cli.core.parser import InvalidArgumentValueError - raise InvalidArgumentValueError('usage error: {} is an invalid {} id' - .format(resource_id, 'VM resource' if is_vm else 'gallery image version')) - namespace.managed_image = resource_id - - -# endregion - - -def process_vm_vmss_stop(cmd, namespace): # pylint: disable=unused-argument - if "vmss" in cmd.name: - logger.warning("About to power off the VMSS instances...\nThey will continue to be billed. " - "To deallocate VMSS instances, run: az vmss deallocate.") - else: - logger.warning("About to power off the specified VM...\nIt will continue to be billed. " - "To deallocate a VM, run: az vm deallocate.") - - -def _validate_vmss_update_terminate_notification_related(cmd, namespace): # pylint: disable=unused-argument - """ - Validate vmss update enable_terminate_notification and terminate_notification_time. - If terminate_notification_time is specified, enable_terminate_notification should not be false - If enable_terminate_notification is true, must specify terminate_notification_time - """ - if namespace.enable_terminate_notification is False and namespace.terminate_notification_time is not None: - raise CLIError("usage error: please enable --enable-terminate-notification") - if namespace.enable_terminate_notification is True and namespace.terminate_notification_time is None: - raise CLIError("usage error: please set --terminate-notification-time") - _validate_vmss_terminate_notification(cmd, namespace) - - -def _validate_vmss_terminate_notification(cmd, namespace): # pylint: disable=unused-argument - """ - Transform minutes to ISO 8601 formmat - """ - if namespace.terminate_notification_time is not None: - namespace.terminate_notification_time = 'PT' + namespace.terminate_notification_time + 'M' - - -def _validate_vmss_create_automatic_repairs(cmd, namespace): # pylint: disable=unused-argument - if namespace.automatic_repairs_grace_period is not None or namespace.automatic_repairs_action is not None: - if namespace.load_balancer is None or namespace.health_probe is None: - raise ArgumentUsageError("usage error: --load-balancer and --health-probe are required " - "when creating vmss with automatic repairs") - _validate_vmss_automatic_repairs(cmd, namespace) - - -def _validate_vmss_update_automatic_repairs(cmd, namespace): # pylint: disable=unused-argument - if namespace.enable_automatic_repairs is False and \ - (namespace.automatic_repairs_grace_period is not None or namespace.automatic_repairs_action is not None): - raise ArgumentUsageError("usage error: please enable --enable-automatic-repairs") - if namespace.enable_automatic_repairs is True and namespace.automatic_repairs_grace_period is None \ - and namespace.automatic_repairs_action is None: - raise ArgumentUsageError("usage error: please set --automatic-repairs-grace-period or" - " --automatic-repairs-action") - _validate_vmss_automatic_repairs(cmd, namespace) - - -def _validate_vmss_automatic_repairs(cmd, namespace): # pylint: disable=unused-argument - """ - Transform minutes to ISO 8601 formmat - """ - if namespace.automatic_repairs_grace_period is not None: - namespace.automatic_repairs_grace_period = 'PT' + namespace.automatic_repairs_grace_period + 'M' - - -def _validate_vmss_create_host_group(cmd, namespace): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - if namespace.host_group: - if not is_valid_resource_id(namespace.host_group): - namespace.host_group = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=namespace.resource_group_name, - namespace='Microsoft.Compute', type='hostGroups', name=namespace.host_group - ) - - -def _validate_count(namespace): - if namespace.count < 2 or namespace.count > 250: - raise ValidationError( - '--count should be in [2, 250]. Please make sure your subscription has enough quota of resources') - banned_params = [ - namespace.attach_data_disks, - namespace.attach_os_disk, - namespace.boot_diagnostics_storage, - namespace.computer_name, - namespace.dedicated_host, - namespace.dedicated_host_group, - namespace.nics, - namespace.os_disk_name, - namespace.private_ip_address, - namespace.public_ip_address, - namespace.public_ip_address_dns_name, - namespace.storage_account, - namespace.storage_container_name, - namespace.use_unmanaged_disk, - ] - params_str = [ - '--attach-data-disks', - '--attach-os-disk', - '--boot-diagnostics-storage', - '--computer-name', - '--host', - '--host-group', - '--nics', - '--os-disk-name', - '--private-ip-address', - '--public-ip-address', - '--public-ip-address-dns-name', - '--storage-account', - '--storage-container-name', - '--subnet', - '--use-unmanaged-disk', - '--vnet-name' - ] - if any(param for param in banned_params): - raise ValidationError('When --count is specified, {} are not allowed'.format(', '.join(params_str))) - - -def validate_edge_zone(cmd, namespace): # pylint: disable=unused-argument - if namespace.edge_zone: - namespace.edge_zone = { - 'name': namespace.edge_zone, - 'type': 'EdgeZone' - } - - -def _validate_capacity_reservation_group(cmd, namespace): - if namespace.capacity_reservation_group and namespace.capacity_reservation_group != 'None': - - from azure.mgmt.core.tools import is_valid_resource_id, resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - if not is_valid_resource_id(namespace.capacity_reservation_group): - namespace.capacity_reservation_group = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), - resource_group=namespace.resource_group_name, - namespace='Microsoft.Compute', - type='CapacityReservationGroups', - name=namespace.capacity_reservation_group - ) - - -def _validate_vm_vmss_create_ephemeral_placement(namespace): - ephemeral_os_disk = getattr(namespace, 'ephemeral_os_disk', None) - ephemeral_os_disk_placement = getattr(namespace, 'ephemeral_os_disk_placement', None) - if ephemeral_os_disk_placement and not ephemeral_os_disk: - raise ArgumentUsageError('usage error: --ephemeral-os-disk-placement is only configurable when ' - '--ephemeral-os-disk is specified.') - - -def _validate_vm_vmss_update_ephemeral_placement(cmd, namespace): # pylint: disable=unused-argument - size = getattr(namespace, 'size', None) - ephemeral_os_disk_placement = getattr(namespace, 'ephemeral_os_disk_placement', None) - source = getattr(namespace, 'command').split()[0] - if ephemeral_os_disk_placement: - if source == 'vm' and not size: - raise ArgumentUsageError('usage error: --ephemeral-os-disk-placement is only configurable when ' - '--size is specified.') - - -def _validate_community_gallery_legal_agreement_acceptance(cmd, namespace): - from ._vm_utils import is_community_gallery_image_id, parse_community_gallery_image_id - if not is_community_gallery_image_id(namespace.image) or namespace.accept_term: - return - - community_gallery_name, _ = parse_community_gallery_image_id(namespace.image) - from ._client_factory import cf_community_gallery - try: - community_gallery_info = cf_community_gallery(cmd.cli_ctx).get(namespace.location, community_gallery_name) - eula = community_gallery_info.additional_properties['communityMetadata']['eula'] - except Exception as err: - raise CLIInternalError('Get the eula from community gallery failed: {0}'.format(err)) - - from knack.prompting import prompt_y_n - msg = "To create the VM/VMSS from community gallery image, you must accept the license agreement and " \ - "privacy statement: {}. (If you want to accept the legal terms by default, " \ - "please use the option '--accept-term' when creating VM/VMSS)".format(eula) - - if not prompt_y_n(msg, default="y"): - import sys - sys.exit(0) diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_vm_diagnostics_templates.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_vm_diagnostics_templates.py deleted file mode 100644 index 1ea05038d40..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_vm_diagnostics_templates.py +++ /dev/null @@ -1,983 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# flake8: noqa -# noqa -# pylint: skip-file - - -def get_default_diag_config(is_windows): - if is_windows: - return { - "WadCfg": { - "DiagnosticMonitorConfiguration": { - "overallQuotaInMB": 4096, - "DiagnosticInfrastructureLogs": { - "scheduledTransferLogLevelFilter": "Error", - "scheduledTransferPeriod": "PT1M" - }, - "WindowsEventLog": { - "scheduledTransferPeriod": "PT1M", - "DataSource": [ - {"name": "Application!*[System[(Level=1 or Level=2)]]"}, - {"name": "System!*[System[(Level=1 or Level=2)]]"} - ] - }, - "Directories": { - "scheduledTransferPeriod": "PT1M" - }, - "PerformanceCounters": { - "scheduledTransferPeriod": "PT1M", - "PerformanceCounterConfiguration": [ - { - "counterSpecifier": "\\Processor(_Total)\\% Processor Time", - "sampleRate": "PT15S", - "unit": "Percent", - "annotation": [ - { - "displayName": "CPU utilization", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Processor(_Total)\\% Privileged Time", - "sampleRate": "PT15S", - "unit": "Percent", - "annotation": [ - { - "displayName": "CPU privileged time", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Processor(_Total)\\% User Time", - "sampleRate": "PT15S", - "unit": "Percent", - "annotation": [ - { - "displayName": "CPU user time", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Processor Information(_Total)\\Processor Frequency", - "sampleRate": "PT15S", - "unit": "Count", - "annotation": [ - { - "displayName": "CPU frequency", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\System\\Processes", - "sampleRate": "PT15S", - "unit": "Count", - "annotation": [ - { - "displayName": "Processes", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Process(_Total)\\Thread Count", - "sampleRate": "PT15S", - "unit": "Count", - "annotation": [ - { - "displayName": "Threads", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Process(_Total)\\Handle Count", - "sampleRate": "PT15S", - "unit": "Count", - "annotation": [ - { - "displayName": "Handles", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Memory\\% Committed Bytes In Use", - "sampleRate": "PT15S", - "unit": "Percent", - "annotation": [ - { - "displayName": "Memory usage", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Memory\\Available Bytes", - "sampleRate": "PT15S", - "unit": "Bytes", - "annotation": [ - { - "displayName": "Memory available", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Memory\\Committed Bytes", - "sampleRate": "PT15S", - "unit": "Bytes", - "annotation": [ - { - "displayName": "Memory committed", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\Memory\\Commit Limit", - "sampleRate": "PT15S", - "unit": "Bytes", - "annotation": [ - { - "displayName": "Memory commit limit", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\% Disk Time", - "sampleRate": "PT15S", - "unit": "Percent", - "annotation": [ - { - "displayName": "Disk active time", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\% Disk Read Time", - "sampleRate": "PT15S", - "unit": "Percent", - "annotation": [ - { - "displayName": "Disk active read time", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\% Disk Write Time", - "sampleRate": "PT15S", - "unit": "Percent", - "annotation": [ - { - "displayName": "Disk active write time", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\Disk Transfers/sec", - "sampleRate": "PT15S", - "unit": "CountPerSecond", - "annotation": [ - { - "displayName": "Disk operations", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\Disk Reads/sec", - "sampleRate": "PT15S", - "unit": "CountPerSecond", - "annotation": [ - { - "displayName": "Disk read operations", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\Disk Writes/sec", - "sampleRate": "PT15S", - "unit": "CountPerSecond", - "annotation": [ - { - "displayName": "Disk write operations", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\Disk Bytes/sec", - "sampleRate": "PT15S", - "unit": "BytesPerSecond", - "annotation": [ - { - "displayName": "Disk speed", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\Disk Read Bytes/sec", - "sampleRate": "PT15S", - "unit": "BytesPerSecond", - "annotation": [ - { - "displayName": "Disk read speed", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\PhysicalDisk(_Total)\\Disk Write Bytes/sec", - "sampleRate": "PT15S", - "unit": "BytesPerSecond", - "annotation": [ - { - "displayName": "Disk write speed", - "locale": "en-us" - } - ] - }, - { - "counterSpecifier": "\\LogicalDisk(_Total)\\% Free Space", - "sampleRate": "PT15S", - "unit": "Percent", - "annotation": [ - { - "displayName": "Disk free space (percentage)", - "locale": "en-us" - } - ] - } - ] - }, - "Metrics": { - "resourceId": "__VM_OR_VMSS_RESOURCE_ID__", - "MetricAggregation": [ - { - "scheduledTransferPeriod": "PT1H" - }, - { - "scheduledTransferPeriod": "PT1M" - } - ] - } - } - }, - "StorageAccount": "__DIAGNOSTIC_STORAGE_ACCOUNT__" - } - else: - return { - "StorageAccount": "__DIAGNOSTIC_STORAGE_ACCOUNT__", - "ladCfg": { - "diagnosticMonitorConfiguration": { - "eventVolume": "Medium", - "metrics": { - "metricAggregation": [ - { - "scheduledTransferPeriod": "PT1H" - }, - { - "scheduledTransferPeriod": "PT1M" - } - ], - "resourceId": "__VM_OR_VMSS_RESOURCE_ID__" - }, - "performanceCounters": { - "performanceCounterConfiguration": [ - { - "annotation": [ - { - "displayName": "Disk read guest OS", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "readbytespersecond", - "counterSpecifier": "/builtin/disk/readbytespersecond", - "type": "builtin", - "unit": "BytesPerSecond" - }, - { - "annotation": [ - { - "displayName": "Disk writes", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "writespersecond", - "counterSpecifier": "/builtin/disk/writespersecond", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Disk transfer time", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "averagetransfertime", - "counterSpecifier": "/builtin/disk/averagetransfertime", - "type": "builtin", - "unit": "Seconds" - }, - { - "annotation": [ - { - "displayName": "Disk transfers", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "transferspersecond", - "counterSpecifier": "/builtin/disk/transferspersecond", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Disk write guest OS", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "writebytespersecond", - "counterSpecifier": "/builtin/disk/writebytespersecond", - "type": "builtin", - "unit": "BytesPerSecond" - }, - { - "annotation": [ - { - "displayName": "Disk read time", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "averagereadtime", - "counterSpecifier": "/builtin/disk/averagereadtime", - "type": "builtin", - "unit": "Seconds" - }, - { - "annotation": [ - { - "displayName": "Disk write time", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "averagewritetime", - "counterSpecifier": "/builtin/disk/averagewritetime", - "type": "builtin", - "unit": "Seconds" - }, - { - "annotation": [ - { - "displayName": "Disk total bytes", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "bytespersecond", - "counterSpecifier": "/builtin/disk/bytespersecond", - "type": "builtin", - "unit": "BytesPerSecond" - }, - { - "annotation": [ - { - "displayName": "Disk reads", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "readspersecond", - "counterSpecifier": "/builtin/disk/readspersecond", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Disk queue length", - "locale": "en-us" - } - ], - "class": "disk", - "condition": "IsAggregate=TRUE", - "counter": "averagediskqueuelength", - "counterSpecifier": "/builtin/disk/averagediskqueuelength", - "type": "builtin", - "unit": "Count" - }, - { - "annotation": [ - { - "displayName": "Network in guest OS", - "locale": "en-us" - } - ], - "class": "network", - "counter": "bytesreceived", - "counterSpecifier": "/builtin/network/bytesreceived", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Network total bytes", - "locale": "en-us" - } - ], - "class": "network", - "counter": "bytestotal", - "counterSpecifier": "/builtin/network/bytestotal", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Network out guest OS", - "locale": "en-us" - } - ], - "class": "network", - "counter": "bytestransmitted", - "counterSpecifier": "/builtin/network/bytestransmitted", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Network collisions", - "locale": "en-us" - } - ], - "class": "network", - "counter": "totalcollisions", - "counterSpecifier": "/builtin/network/totalcollisions", - "type": "builtin", - "unit": "Count" - }, - { - "annotation": [ - { - "displayName": "Packets received errors", - "locale": "en-us" - } - ], - "class": "network", - "counter": "totalrxerrors", - "counterSpecifier": "/builtin/network/totalrxerrors", - "type": "builtin", - "unit": "Count" - }, - { - "annotation": [ - { - "displayName": "Packets sent", - "locale": "en-us" - } - ], - "class": "network", - "counter": "packetstransmitted", - "counterSpecifier": "/builtin/network/packetstransmitted", - "type": "builtin", - "unit": "Count" - }, - { - "annotation": [ - { - "displayName": "Packets received", - "locale": "en-us" - } - ], - "class": "network", - "counter": "packetsreceived", - "counterSpecifier": "/builtin/network/packetsreceived", - "type": "builtin", - "unit": "Count" - }, - { - "annotation": [ - { - "displayName": "Packets sent errors", - "locale": "en-us" - } - ], - "class": "network", - "counter": "totaltxerrors", - "counterSpecifier": "/builtin/network/totaltxerrors", - "type": "builtin", - "unit": "Count" - }, - { - "annotation": [ - { - "displayName": "Filesystem transfers/sec", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "transferspersecond", - "counterSpecifier": "/builtin/filesystem/transferspersecond", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Filesystem % free space", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "percentfreespace", - "counterSpecifier": "/builtin/filesystem/percentfreespace", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "Filesystem % used space", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "percentusedspace", - "counterSpecifier": "/builtin/filesystem/percentusedspace", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "Filesystem used space", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "usedspace", - "counterSpecifier": "/builtin/filesystem/usedspace", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Filesystem read bytes/sec", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "bytesreadpersecond", - "counterSpecifier": "/builtin/filesystem/bytesreadpersecond", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Filesystem free space", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "freespace", - "counterSpecifier": "/builtin/filesystem/freespace", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Filesystem % free inodes", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "percentfreeinodes", - "counterSpecifier": "/builtin/filesystem/percentfreeinodes", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "Filesystem bytes/sec", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "bytespersecond", - "counterSpecifier": "/builtin/filesystem/bytespersecond", - "type": "builtin", - "unit": "BytesPerSecond" - }, - { - "annotation": [ - { - "displayName": "Filesystem reads/sec", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "readspersecond", - "counterSpecifier": "/builtin/filesystem/readspersecond", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Filesystem write bytes/sec", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "byteswrittenpersecond", - "counterSpecifier": "/builtin/filesystem/byteswrittenpersecond", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Filesystem writes/sec", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "writespersecond", - "counterSpecifier": "/builtin/filesystem/writespersecond", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Filesystem % used inodes", - "locale": "en-us" - } - ], - "class": "filesystem", - "condition": "IsAggregate=TRUE", - "counter": "percentusedinodes", - "counterSpecifier": "/builtin/filesystem/percentusedinodes", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "CPU IO wait time", - "locale": "en-us" - } - ], - "class": "processor", - "condition": "IsAggregate=TRUE", - "counter": "percentiowaittime", - "counterSpecifier": "/builtin/processor/percentiowaittime", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "CPU user time", - "locale": "en-us" - } - ], - "class": "processor", - "condition": "IsAggregate=TRUE", - "counter": "percentusertime", - "counterSpecifier": "/builtin/processor/percentusertime", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "CPU nice time", - "locale": "en-us" - } - ], - "class": "processor", - "condition": "IsAggregate=TRUE", - "counter": "percentnicetime", - "counterSpecifier": "/builtin/processor/percentnicetime", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "CPU percentage guest OS", - "locale": "en-us" - } - ], - "class": "processor", - "condition": "IsAggregate=TRUE", - "counter": "percentprocessortime", - "counterSpecifier": "/builtin/processor/percentprocessortime", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "CPU interrupt time", - "locale": "en-us" - } - ], - "class": "processor", - "condition": "IsAggregate=TRUE", - "counter": "percentinterrupttime", - "counterSpecifier": "/builtin/processor/percentinterrupttime", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "CPU idle time", - "locale": "en-us" - } - ], - "class": "processor", - "condition": "IsAggregate=TRUE", - "counter": "percentidletime", - "counterSpecifier": "/builtin/processor/percentidletime", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "CPU privileged time", - "locale": "en-us" - } - ], - "class": "processor", - "condition": "IsAggregate=TRUE", - "counter": "percentprivilegedtime", - "counterSpecifier": "/builtin/processor/percentprivilegedtime", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "Memory available", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "availablememory", - "counterSpecifier": "/builtin/memory/availablememory", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Swap percent used", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "percentusedswap", - "counterSpecifier": "/builtin/memory/percentusedswap", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "Memory used", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "usedmemory", - "counterSpecifier": "/builtin/memory/usedmemory", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Page reads", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "pagesreadpersec", - "counterSpecifier": "/builtin/memory/pagesreadpersec", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Swap available", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "availableswap", - "counterSpecifier": "/builtin/memory/availableswap", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Swap percent available", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "percentavailableswap", - "counterSpecifier": "/builtin/memory/percentavailableswap", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "Mem. percent available", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "percentavailablememory", - "counterSpecifier": "/builtin/memory/percentavailablememory", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "Pages", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "pagespersec", - "counterSpecifier": "/builtin/memory/pagespersec", - "type": "builtin", - "unit": "CountPerSecond" - }, - { - "annotation": [ - { - "displayName": "Swap used", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "usedswap", - "counterSpecifier": "/builtin/memory/usedswap", - "type": "builtin", - "unit": "Bytes" - }, - { - "annotation": [ - { - "displayName": "Memory percentage", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "percentusedmemory", - "counterSpecifier": "/builtin/memory/percentusedmemory", - "type": "builtin", - "unit": "Percent" - }, - { - "annotation": [ - { - "displayName": "Page writes", - "locale": "en-us" - } - ], - "class": "memory", - "counter": "pageswrittenpersec", - "counterSpecifier": "/builtin/memory/pageswrittenpersec", - "type": "builtin", - "unit": "CountPerSecond" - } - ] - }, - "syslogEvents": { - "syslogEventConfiguration": { - "LOG_AUTH": "LOG_DEBUG", - "LOG_AUTHPRIV": "LOG_DEBUG", - "LOG_CRON": "LOG_DEBUG", - "LOG_DAEMON": "LOG_DEBUG", - "LOG_FTP": "LOG_DEBUG", - "LOG_KERN": "LOG_DEBUG", - "LOG_LOCAL0": "LOG_DEBUG", - "LOG_LOCAL1": "LOG_DEBUG", - "LOG_LOCAL2": "LOG_DEBUG", - "LOG_LOCAL3": "LOG_DEBUG", - "LOG_LOCAL4": "LOG_DEBUG", - "LOG_LOCAL5": "LOG_DEBUG", - "LOG_LOCAL6": "LOG_DEBUG", - "LOG_LOCAL7": "LOG_DEBUG", - "LOG_LPR": "LOG_DEBUG", - "LOG_MAIL": "LOG_DEBUG", - "LOG_NEWS": "LOG_DEBUG", - "LOG_SYSLOG": "LOG_DEBUG", - "LOG_USER": "LOG_DEBUG", - "LOG_UUCP": "LOG_DEBUG" - } - } - }, - "sampleRateInSeconds": 15 - } - } diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_vm_utils.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_vm_utils.py deleted file mode 100644 index 38932b5341e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/_vm_utils.py +++ /dev/null @@ -1,755 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -import importlib -import json -import os -import re - -from azure.cli.core.commands.arm import ArmTemplateBuilder - -from urllib.parse import urlparse - -from knack.log import get_logger -from knack.util import CLIError - -logger = get_logger(__name__) - -MSI_LOCAL_ID = '[system]' - - -def get_target_network_api(cli_ctx): - """ - The fixed version of network used by ARM template deployment. - This is consistent with the version settings of other RP to ensure the stability of core commands "az vm create" - and "az vmss create". - In addition, it can also reduce the workload of re-recording a large number of vm tests after bumping the - network api-version. - Since it does not use the Python SDK, so it will not increase the dependence on the Python SDK - """ - if cli_ctx.cloud.profile == 'latest': - version = '2022-01-01' - else: - from azure.cli.core.profiles import get_api_version, ResourceType - version = get_api_version(cli_ctx, ResourceType.MGMT_NETWORK) - return version - - -def read_content_if_is_file(string_or_file): - content = string_or_file - if os.path.exists(string_or_file): - with open(string_or_file, 'r') as f: - content = f.read() - return content - - -def _resolve_api_version(cli_ctx, provider_namespace, resource_type, parent_path): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.cli.core.profiles import ResourceType - client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES) - provider = client.providers.get(provider_namespace) - - # If available, we will use parent resource's api-version - resource_type_str = (parent_path.split('/')[0] if parent_path else resource_type) - - rt = [t for t in provider.resource_types # pylint: disable=no-member - if t.resource_type.lower() == resource_type_str.lower()] - if not rt: - raise CLIError('Resource type {} not found.'.format(resource_type_str)) - if len(rt) == 1 and rt[0].api_versions: - npv = [v for v in rt[0].api_versions if 'preview' not in v.lower()] - return npv[0] if npv else rt[0].api_versions[0] - raise CLIError( - 'API version is required and could not be resolved for resource {}' - .format(resource_type)) - - -def log_pprint_template(template): - logger.info('==== BEGIN TEMPLATE ====') - logger.info(json.dumps(template, indent=2)) - logger.info('==== END TEMPLATE ====') - - -def check_existence(cli_ctx, value, resource_group, provider_namespace, resource_type, - parent_name=None, parent_type=None): - # check for name or ID and set the type flags - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.core.exceptions import HttpResponseError - from azure.mgmt.core.tools import parse_resource_id - from azure.cli.core.profiles import ResourceType - id_parts = parse_resource_id(value) - resource_client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, - subscription_id=id_parts.get('subscription', None)).resources - rg = id_parts.get('resource_group', resource_group) - ns = id_parts.get('namespace', provider_namespace) - - if parent_name and parent_type: - parent_path = '{}/{}'.format(parent_type, parent_name) - resource_name = id_parts.get('child_name_1', value) - resource_type = id_parts.get('child_type_1', resource_type) - else: - parent_path = '' - resource_name = id_parts['name'] - resource_type = id_parts.get('type', resource_type) - api_version = _resolve_api_version(cli_ctx, provider_namespace, resource_type, parent_path) - - try: - resource_client.get(rg, ns, parent_path, resource_type, resource_name, api_version) - return True - except HttpResponseError: - return False - - -def create_data_plane_keyvault_certificate_client(cli_ctx, vault_base_url): - from azure.cli.command_modules.keyvault._client_factory import data_plane_azure_keyvault_certificate_client - return data_plane_azure_keyvault_certificate_client(cli_ctx, {"vault_base_url": vault_base_url}) - - -def create_data_plane_keyvault_key_client(cli_ctx, vault_base_url): - from azure.cli.command_modules.keyvault._client_factory import data_plane_azure_keyvault_key_client - return data_plane_azure_keyvault_key_client(cli_ctx, {"vault_base_url": vault_base_url}) - - -def get_key_vault_base_url(cli_ctx, vault_name): - suffix = cli_ctx.cloud.suffixes.keyvault_dns - return 'https://{}{}'.format(vault_name, suffix) - - -def list_sku_info(cli_ctx, location=None): - _ListSkus = import_aaz_by_profile(cli_ctx.cloud.profile, 'vm').ListSkus - - def _match_location(loc, locations): - return next((x for x in locations if str(x).lower() == str(loc).lower()), None) - - result = _ListSkus(cli_ctx=cli_ctx)(command_args={}) - if location: - result = [r for r in result if _match_location(location, r['locations'])] - return result - - -# pylint: disable=line-too-long -def is_sku_available(cmd, sku_info, zone): - """ - The SKU is unavailable in the following cases: - 1. regional restriction and the region is restricted - 2. parameter --zone is input which indicates only showing skus with availability zones. - Meanwhile, zonal restriction and all zones are restricted - """ - is_available = True - is_restrict_zone = False - is_restrict_location = False - if not sku_info.get('restrictions', []): - return is_available - for restriction in sku_info['restrictions']: - if restriction.get('reason_code', '') == 'NotAvailableForSubscription': - # The attribute location_info is not supported in versions 2017-03-30 and earlier - if cmd.supported_api_version(max_api='2017-03-30'): - is_available = False - break - if restriction['type'] == 'Zone' and not ( - set(sku_info['location_info'][0].get('zones', []) or []) - set(restriction['restriction_info'].get('zones', []) or [])): - is_restrict_zone = True - if restriction['type'] == 'Location' and ( - sku_info['location_info'][0]['location'] in (restriction['restriction_info'].get('locations', []) or [])): - is_restrict_location = True - - if is_restrict_location or (is_restrict_zone and zone): - is_available = False - break - return is_available - - -# pylint: disable=too-many-statements, too-many-branches, too-many-locals -def normalize_disk_info(image_data_disks=None, - data_disk_sizes_gb=None, attach_data_disks=None, storage_sku=None, - os_disk_caching=None, data_disk_cachings=None, size='', - ephemeral_os_disk=False, ephemeral_os_disk_placement=None, - data_disk_delete_option=None, source_snapshots_or_disks=None, - source_snapshots_or_disks_size_gb=None, source_disk_restore_point=None, - source_disk_restore_point_size_gb=None): - from azure.mgmt.core.tools import is_valid_resource_id - from ._validators import validate_delete_options - is_lv_size = re.search('_L[0-9]+s', size, re.I) - # we should return a dictionary with info like below - # { - # 'os': { caching: 'Read', write_accelerator: None}, - # 0: { caching: 'None', write_accelerator: True}, - # 1: { caching: 'None', write_accelerator: True}, - # } - info = {} - used_luns = set() - - attach_data_disks = attach_data_disks or [] - data_disk_sizes_gb = data_disk_sizes_gb or [] - image_data_disks = image_data_disks or [] - source_snapshots_or_disks = source_snapshots_or_disks or [] - source_snapshots_or_disks_size_gb = source_snapshots_or_disks_size_gb or [] - source_disk_restore_point = source_disk_restore_point or [] - source_disk_restore_point_size_gb = source_disk_restore_point_size_gb or [] - - if data_disk_delete_option: - if attach_data_disks: - data_disk_delete_option = validate_delete_options(attach_data_disks, data_disk_delete_option) - else: - if isinstance(data_disk_delete_option, list) and len(data_disk_delete_option) == 1 and len( - data_disk_delete_option[0].split('=')) == 1: # pylint: disable=line-too-long - data_disk_delete_option = data_disk_delete_option[0] - info['os'] = {} - # update os diff disk settings - if ephemeral_os_disk: - info['os']['diffDiskSettings'] = {'option': 'Local'} - # local os disks require readonly caching, default to ReadOnly if os_disk_caching not specified. - if not os_disk_caching: - os_disk_caching = 'ReadOnly' - if ephemeral_os_disk_placement: - info['os']['diffDiskSettings']['placement'] = ephemeral_os_disk_placement - - # add managed image data disks - for data_disk in image_data_disks: - i = data_disk['lun'] - info[i] = { - 'lun': i, - 'managedDisk': {'storageAccountType': None}, - 'createOption': 'fromImage' - } - used_luns.add(i) - - # add empty data disks, do not use existing luns - i = 0 - sizes_copy = list(data_disk_sizes_gb) - while sizes_copy: - # get free lun - while i in used_luns: - i += 1 - - used_luns.add(i) - - info[i] = { - 'lun': i, - 'managedDisk': {'storageAccountType': None}, - 'createOption': 'empty', - 'diskSizeGB': sizes_copy.pop(0), - } - if isinstance(data_disk_delete_option, str): - info[i]['deleteOption'] = data_disk_delete_option - - # add copy data disks - i = 0 - source_resource_copy = list(source_snapshots_or_disks) - source_resource_copy_size = list(source_snapshots_or_disks_size_gb) - while source_resource_copy: - while i in used_luns: - i += 1 - - used_luns.add(i) - - info[i] = { - 'lun': i, - 'createOption': 'copy', - 'managedDisk': {'storageAccountType': None}, - 'diskSizeGB': source_resource_copy_size.pop(0), - 'sourceResource': { - 'id': source_resource_copy.pop(0) - } - } - - # add restore data disks - i = 0 - source_resource_restore = list(source_disk_restore_point) - source_resource_restore_size = list(source_disk_restore_point_size_gb) - while source_resource_restore: - while i in used_luns: - i += 1 - - used_luns.add(i) - - info[i] = { - 'lun': i, - 'createOption': 'restore', - 'managedDisk': {'storageAccountType': None}, - 'diskSizeGB': source_resource_restore_size.pop(0), - 'sourceResource': { - 'id': source_resource_restore.pop(0) - } - } - - # update storage skus for managed data disks - if storage_sku is not None: - update_disk_sku_info(info, storage_sku) - - # check that os storage account type is not UltraSSD_LRS - if info['os'].get('storageAccountType', "").lower() == 'ultrassd_lrs': - logger.warning("Managed os disk storage account sku cannot be UltraSSD_LRS. Using service default.") - info['os']['storageAccountType'] = None - - # add attached data disks - i = 0 - attach_data_disks_copy = list(attach_data_disks) - while attach_data_disks_copy: - # get free lun - while i in used_luns: - i += 1 - - used_luns.add(i) - - # use free lun - info[i] = { - 'lun': i, - 'createOption': 'attach' - } - - d = attach_data_disks_copy.pop(0) - info[i]['name'] = d.split('/')[-1].split('.')[0] - if is_valid_resource_id(d): - info[i]['managedDisk'] = {'id': d} - if data_disk_delete_option: - info[i]['deleteOption'] = data_disk_delete_option if isinstance(data_disk_delete_option, str) \ - else data_disk_delete_option.get(info[i]['name'], None) - else: - info[i]['vhd'] = {'uri': d} - if data_disk_delete_option: - info[i]['deleteOption'] = data_disk_delete_option if isinstance(data_disk_delete_option, str) \ - else data_disk_delete_option.get(info[i]['name'], None) - - # fill in data disk caching - if data_disk_cachings: - update_disk_caching(info, data_disk_cachings) - - # default os disk caching to 'ReadWrite' unless set otherwise - if os_disk_caching: - info['os']['caching'] = os_disk_caching - else: - info['os']['caching'] = 'None' if is_lv_size else 'ReadWrite' - - # error out on invalid vm sizes - if is_lv_size: - for v in info.values(): - if v.get('caching', 'None').lower() != 'none': - raise CLIError('usage error: for Lv series of machines, "None" is the only supported caching mode') - - result_info = {'os': info['os']} - - # in python 3 insertion order matters during iteration. This ensures that luns are retrieved in numerical order - for key in sorted([key for key in info if key != 'os']): - result_info[key] = info[key] - - return result_info - - -def update_disk_caching(model, caching_settings): - def _update(model, lun, value): - if isinstance(model, dict): - luns = model.keys() if lun is None else [lun] - for lun_item in luns: - if lun_item not in model: - raise CLIError("Data disk with lun of '{}' doesn't exist. Existing luns: {}." - .format(lun_item, list(model.keys()))) - model[lun_item]['caching'] = value - else: - if lun is None: - disks = [model.os_disk] + (model.data_disks or []) - elif lun == 'os': - disks = [model.os_disk] - else: - disk = next((d for d in model.data_disks if d.lun == lun), None) - if not disk: - raise CLIError("data disk with lun of '{}' doesn't exist".format(lun)) - disks = [disk] - for disk in disks: - disk.caching = value - - if len(caching_settings) == 1 and '=' not in caching_settings[0]: - _update(model, None, caching_settings[0]) - else: - for x in caching_settings: - if '=' not in x: - raise CLIError("usage error: please use 'LUN=VALUE' to configure caching on individual disk") - lun, value = x.split('=', 1) - lun = lun.lower() - lun = int(lun) if lun != 'os' else lun - _update(model, lun, value) - - -def update_write_accelerator_settings(model, write_accelerator_settings): - def _update(model, lun, value): - if isinstance(model, dict): - luns = model.keys() if lun is None else [lun] - for lun_item in luns: - if lun_item not in model: - raise CLIError("data disk with lun of '{}' doesn't exist".format(lun_item)) - model[lun_item]['writeAcceleratorEnabled'] = value - else: - if lun is None: - disks = [model.os_disk] + (model.data_disks or []) - elif lun == 'os': - disks = [model.os_disk] - else: - disk = next((d for d in model.data_disks if d.lun == lun), None) - if not disk: - raise CLIError("data disk with lun of '{}' doesn't exist".format(lun)) - disks = [disk] - for disk in disks: - disk.write_accelerator_enabled = value - - if len(write_accelerator_settings) == 1 and '=' not in write_accelerator_settings[0]: - _update(model, None, write_accelerator_settings[0].lower() == 'true') - else: - for x in write_accelerator_settings: - if '=' not in x: - raise CLIError("usage error: please use 'LUN=VALUE' to configure write accelerator" - " on individual disk") - lun, value = x.split('=', 1) - lun = lun.lower() - lun = int(lun) if lun != 'os' else lun - _update(model, lun, value.lower() == 'true') - - -def get_storage_blob_uri(cli_ctx, storage): - from azure.cli.core.profiles._shared import ResourceType - from azure.cli.core.commands.client_factory import get_mgmt_service_client - if urlparse(storage).scheme: - storage_uri = storage - else: - storage_mgmt_client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_STORAGE) - storage_accounts = storage_mgmt_client.storage_accounts.list() - storage_account = next((a for a in list(storage_accounts) - if a.name.lower() == storage.lower()), None) - if storage_account is None: - raise CLIError('{} does\'t exist.'.format(storage)) - storage_uri = storage_account.primary_endpoints.blob - return storage_uri - - -def update_disk_sku_info(info_dict, skus): - usage_msg = 'Usage:\n\t[--storage-sku SKU | --storage-sku ID=SKU ID=SKU ID=SKU...]\n' \ - 'where each ID is "os" or a 0-indexed lun.' - - def _update(info, lun, value): - luns = info.keys() - if lun not in luns: - raise CLIError("Data disk with lun of '{}' doesn't exist. Existing luns: {}.".format(lun, luns)) - if lun == 'os': - info[lun]['storageAccountType'] = value - else: - info[lun]['managedDisk']['storageAccountType'] = value - - if len(skus) == 1 and '=' not in skus[0]: - for lun in info_dict.keys(): - _update(info_dict, lun, skus[0]) - else: - for sku in skus: - if '=' not in sku: - raise CLIError("A sku's format is incorrect.\n{}".format(usage_msg)) - - lun, value = sku.split('=', 1) - lun = lun.lower() - try: - lun = int(lun) if lun != "os" else lun - except ValueError: - raise CLIError("A sku ID is incorrect.\n{}".format(usage_msg)) - _update(info_dict, lun, value) - - -def is_shared_gallery_image_id(image_reference): - if not image_reference: - return False - - shared_gallery_id_pattern = re.compile(r'^/SharedGalleries/[^/]*/Images/[^/]*/Versions/.*$', re.IGNORECASE) - if shared_gallery_id_pattern.match(image_reference): - return True - - return False - - -def is_valid_vm_resource_id(vm_resource_id): - if not vm_resource_id: - return False - - vm_id_pattern = re.compile(r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.Compute/' - r'virtualMachines/.*$', re.IGNORECASE) - if vm_id_pattern.match(vm_resource_id): - return True - - return False - - -def is_valid_vmss_resource_id(vmss_resource_id): - if not vmss_resource_id: - return False - - vmss_id_pattern = re.compile(r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.Compute/' - r'virtualMachineScaleSets/.*$', re.IGNORECASE) - if vmss_id_pattern.match(vmss_resource_id): - return True - - return False - - -def is_valid_image_version_id(image_version_id): - if not image_version_id: - return False - - image_version_id_pattern = re.compile(r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.Compute/' - r'galleries/[^/]*/images/[^/]*/versions/.*$', re.IGNORECASE) - if image_version_id_pattern.match(image_version_id): - return True - - return False - - -def is_valid_vm_image_id(image_image_id): - if not image_image_id: - return False - - image_version_id_pattern = re.compile(r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.Compute/' - r'images/.*$', re.IGNORECASE) - if image_version_id_pattern.match(image_image_id): - return True - - return False - - -def parse_gallery_image_id(image_reference): - from azure.cli.core.azclierror import InvalidArgumentValueError - - if not image_reference: - raise InvalidArgumentValueError( - 'Please pass in the gallery image id through the parameter --image') - - image_info = re.search(r'^/subscriptions/([^/]*)/resourceGroups/([^/]*)/providers/Microsoft.Compute/' - r'galleries/([^/]*)/images/([^/]*)/versions/.*$', image_reference, re.IGNORECASE) - if not image_info or len(image_info.groups()) < 2: - raise InvalidArgumentValueError( - 'The gallery image id is invalid. The valid format should be "/subscriptions/{sub_id}' - '/resourceGroups/{rg}/providers/Microsoft.Compute/galleries/{gallery_name}' - '/Images/{gallery_image_name}/Versions/{image_version}"') - - # Return the gallery subscription id, resource group name, gallery name and gallery image name. - return image_info.group(1), image_info.group(2), image_info.group(3), image_info.group(4) - - -def parse_shared_gallery_image_id(image_reference): - from azure.cli.core.azclierror import InvalidArgumentValueError - - if not image_reference: - raise InvalidArgumentValueError( - 'Please pass in the shared gallery image id through the parameter --image') - - image_info = re.search(r'^/SharedGalleries/([^/]*)/Images/([^/]*)/Versions/.*$', image_reference, re.IGNORECASE) - if not image_info or len(image_info.groups()) < 2: - raise InvalidArgumentValueError( - 'The shared gallery image id is invalid. The valid format should be ' - '"/SharedGalleries/{gallery_unique_name}/Images/{gallery_image_name}/Versions/{image_version}"') - - # Return the gallery unique name and gallery image name parsed from shared gallery image id - return image_info.group(1), image_info.group(2) - - -def parse_vm_image_id(image_id): - from azure.cli.core.azclierror import InvalidArgumentValueError - - image_info = re.search(r'^/subscriptions/([^/]*)/resourceGroups/([^/]*)/providers/Microsoft.Compute/' - r'images/(.*$)', image_id, re.IGNORECASE) - if not image_info or len(image_info.groups()) < 2: - raise InvalidArgumentValueError( - 'The gallery image id is invalid. The valid format should be "/subscriptions/{sub_id}' - '/resourceGroups/{rg}/providers/Microsoft.Compute/images/{image_name}"') - - # Return the gallery subscription id, resource group name and image name. - return image_info.group(1), image_info.group(2), image_info.group(3) - - -def is_compute_gallery_image_id(image_reference): - if not image_reference: - return False - - compute_gallery_id_pattern = re.compile(r'^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.Compute/' - r'galleries/[^/]*/images/.*$', re.IGNORECASE) - if compute_gallery_id_pattern.match(image_reference): - return True - - return False - - -def is_community_gallery_image_id(image_reference): - if not image_reference: - return False - - community_gallery_id_pattern = re.compile(r'^/CommunityGalleries/[^/]*/Images/[^/]*/Versions/.*$', re.IGNORECASE) - if community_gallery_id_pattern.match(image_reference): - return True - - return False - - -def parse_community_gallery_image_id(image_reference): - from azure.cli.core.azclierror import InvalidArgumentValueError - - if not image_reference: - raise InvalidArgumentValueError( - 'Please pass in the community gallery image id through the parameter --image') - - image_info = re.search(r'^/CommunityGalleries/([^/]*)/Images/([^/]*)/Versions/.*$', image_reference, re.IGNORECASE) - if not image_info or len(image_info.groups()) < 2: - raise InvalidArgumentValueError( - 'The community gallery image id is invalid. The valid format should be ' - '"/CommunityGalleries/{gallery_unique_name}/Images/{gallery_image_name}/Versions/{image_version}"') - - # Return the gallery unique name and gallery image name parsed from community gallery image id - return image_info.group(1), image_info.group(2) - - -class ArmTemplateBuilder20190401(ArmTemplateBuilder): - - def __init__(self): - super().__init__() - self.template['$schema'] = 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#' - - -def raise_unsupported_error_for_flex_vmss(vmss, error_message): - if hasattr(vmss, 'orchestration_mode') and vmss.orchestration_mode \ - and vmss.orchestration_mode.lower() == 'flexible': - from azure.cli.core.azclierror import ArgumentUsageError - raise ArgumentUsageError(error_message) - - -def is_trusted_launch_supported(supported_features): - if not supported_features: - return False - - trusted_launch = {'TrustedLaunchSupported', 'TrustedLaunch', 'TrustedLaunchAndConfidentialVmSupported'} - - return bool(trusted_launch.intersection({feature.value for feature in supported_features})) - - -def trusted_launch_warning_log(namespace, generation_version, features): - if not generation_version: - return - - from ._constants import TLAD_DEFAULT_CHANGE_MSG - log_message = TLAD_DEFAULT_CHANGE_MSG.format('az vm/vmss create') - - from ._constants import COMPATIBLE_SECURITY_TYPE_VALUE, UPGRADE_SECURITY_HINT - if generation_version == 'V1': - if namespace.security_type and namespace.security_type == COMPATIBLE_SECURITY_TYPE_VALUE: - logger.warning(UPGRADE_SECURITY_HINT) - else: - logger.warning(log_message) - - if generation_version == 'V2' and is_trusted_launch_supported(features): - if not namespace.security_type: - logger.warning(log_message) - elif namespace.security_type == COMPATIBLE_SECURITY_TYPE_VALUE: - logger.warning(UPGRADE_SECURITY_HINT) - - -def validate_vm_disk_trusted_launch(namespace, disk_security_profile): - from ._constants import UPGRADE_SECURITY_HINT - - if disk_security_profile is None: - logger.warning(UPGRADE_SECURITY_HINT) - return - - security_type = disk_security_profile.security_type if hasattr(disk_security_profile, 'security_type') else None - if security_type.lower() == 'trustedlaunch': - if namespace.enable_secure_boot is None: - namespace.enable_secure_boot = True - if namespace.enable_vtpm is None: - namespace.enable_vtpm = True - namespace.security_type = 'TrustedLaunch' - elif security_type.lower() == 'standard': - logger.warning(UPGRADE_SECURITY_HINT) - - -def validate_image_trusted_launch(namespace): - from ._constants import UPGRADE_SECURITY_HINT - - # set securityType to Standard by default if no inputs by end user - if namespace.security_type is None: - namespace.security_type = 'Standard' - if namespace.security_type.lower() != 'trustedlaunch': - logger.warning(UPGRADE_SECURITY_HINT) - - -def display_region_recommendation(cmd, namespace): - identified_region_maps = { - 'westeurope': 'uksouth', - 'francecentral': 'northeurope', - 'germanywestcentral': 'northeurope' - } - - identified_region = identified_region_maps.get(namespace.location) - from azure.cli.core import telemetry - telemetry.set_region_identified(namespace.location, identified_region) - - if identified_region and cmd.cli_ctx.config.getboolean('core', 'display_region_identified', True): - from azure.cli.core.style import Style, print_styled_text - import sys - # pylint: disable=line-too-long - recommend_region = 'Selecting "' + identified_region + '" may reduce your costs. ' \ - 'The region you\'ve selected may cost more for the same services. ' \ - 'You can disable this message in the future with the command ' - disable_config = '"az config set core.display_region_identified=false". ' - learn_more_msg = 'Learn more at https://go.microsoft.com/fwlink/?linkid=222571 ' - # Since the output of the "az vm create" command is a JSON object - # which can be used for automated script parsing - # So we output the notification message to sys.stderr - print_styled_text([(Style.WARNING, recommend_region), (Style.ACTION, disable_config), - (Style.WARNING, learn_more_msg)], file=sys.stderr) - print_styled_text(file=sys.stderr) - - -def import_aaz_by_profile(profile, module_name): - from azure.cli.core.aaz.utils import get_aaz_profile_module_name - profile_module_name = get_aaz_profile_module_name(profile_name=profile) - return importlib.import_module(f"azure.cli.command_modules.vm.aaz.{profile_module_name}.{module_name}") - - -def generate_ssh_keys_ed25519(private_key_filepath, public_key_filepath): - def _open(filename, mode): - return os.open(filename, flags=os.O_WRONLY | os.O_TRUNC | os.O_CREAT, mode=mode) - - from cryptography.hazmat.primitives import serialization - from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey - - ssh_dir = os.path.dirname(private_key_filepath) - if not os.path.exists(ssh_dir): - os.makedirs(ssh_dir, mode=0o700) - - if os.path.isfile(private_key_filepath): - # Try to use existing private key if it exists. - with open(private_key_filepath, "rb") as f: - private_bytes = f.read() - private_key = serialization.load_ssh_private_key(private_bytes, password=None) - logger.warning("Private SSH key file '%s' was found in the directory: '%s'. " - "A paired public key file '%s' will be generated.", - private_key_filepath, ssh_dir, public_key_filepath) - - else: - # Otherwise generate new private key. - private_key = Ed25519PrivateKey.generate() - - # The private key will look like: - # -----BEGIN OPENSSH PRIVATE KEY----- - # ... - # -----END OPENSSH PRIVATE KEY----- - private_bytes = private_key.private_bytes( - encoding=serialization.Encoding.PEM, - format=serialization.PrivateFormat.OpenSSH, - encryption_algorithm=serialization.NoEncryption() - ) - - with os.fdopen(_open(private_key_filepath, 0o600), "wb") as f: - f.write(private_bytes) - - public_key = private_key.public_key() - public_bytes = public_key.public_bytes( - encoding=serialization.Encoding.OpenSSH, - format=serialization.PublicFormat.OpenSSH) - - with os.fdopen(_open(public_key_filepath, 0o644), 'wb') as f: - f.write(public_bytes) - - return public_bytes.decode() diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/commands.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/commands.py deleted file mode 100644 index 98fa8c59d54..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/commands.py +++ /dev/null @@ -1,487 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -from azure.cli.command_modules.vm.azure_stack._client_factory import (cf_vm, - cf_vm_ext, cf_vm_ext_image, - cf_vm_image, cf_vm_image_term, cf_usage, - cf_vmss, cf_disks, cf_snapshots, - cf_images, cf_run_commands, - cf_gallery_images, - cf_gallery_image_versions, - cf_dedicated_hosts, cf_dedicated_host_groups, - cf_log_analytics_data_plane, - cf_shared_gallery_image, - cf_shared_gallery_image_version, - cf_capacity_reservation_groups, - cf_capacity_reservations, - cf_vmss_run_commands, - cf_restore_point, - cf_restore_point_collection, - cf_community_gallery_image, - cf_community_gallery_image_version) -from azure.cli.command_modules.vm.azure_stack._format import ( - transform_ip_addresses, transform_vm, transform_vm_create_output, transform_vm_usage_list, transform_vm_list, - transform_disk_create_table_output, transform_sku_for_table_output, - transform_extension_show_table_output, get_vmss_table_output_transformer, - transform_vm_encryption_show_table_output, transform_log_analytics_query_output) -from azure.cli.command_modules.vm.azure_stack._validators import ( - process_vm_create_namespace, process_vmss_create_namespace, process_image_create_namespace, - process_disk_create_namespace, process_snapshot_create_namespace, - process_disk_encryption_namespace, process_assign_identity_namespace, - process_remove_identity_namespace, process_vm_secret_format, process_vm_vmss_stop, validate_vmss_update_namespace, - process_vm_update_namespace, process_set_applications_namespace, process_vm_disk_attach_namespace, - process_image_version_create_namespace, process_image_version_update_namespace, - process_image_version_undelete_namespace, process_vm_disk_detach_namespace) - -from azure.cli.command_modules.vm.azure_stack._image_builder import ( - process_image_template_create_namespace, process_img_tmpl_output_add_namespace, - process_img_tmpl_customizer_add_namespace, image_builder_client_factory, cf_img_bldr_image_templates) - -from azure.cli.core.commands import DeploymentOutputLongRunningOperation, CliCommandType -from azure.cli.core.commands.arm import deployment_validate_table_format, handle_template_based_exception - -from azure.cli.command_modules.monitor._exception_handler import exception_handler as monitor_exception_handler -from azure.cli.command_modules.monitor._client_factory import cf_metric_def -from azure.cli.core.profiles import ResourceType - - -# pylint: disable=line-too-long, too-many-statements, too-many-locals -def load_command_table(self, _): - custom_tmpl = 'azure.cli.command_modules.vm.azure_stack.custom#{}' - - compute_custom = CliCommandType(operations_tmpl=custom_tmpl) - - compute_disk_encryption_custom = CliCommandType( - operations_tmpl='azure.cli.command_modules.vm.azure_stack.disk_encryption#{}', - operation_group='virtual_machines' - ) - - image_builder_custom = CliCommandType( - operations_tmpl='azure.cli.command_modules.vm.azure_stack._image_builder#{}', - client_factory=image_builder_client_factory - ) - - compute_availset_profile = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#AvailabilitySetsOperations.{}', - operation_group='availability_sets' - ) - - compute_disk_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#DisksOperations.{}', - client_factory=cf_disks, - operation_group='disks' - ) - - compute_image_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#ImagesOperations.{}', - client_factory=cf_images - ) - - compute_snapshot_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#SnapshotsOperations.{}', - client_factory=cf_snapshots - ) - - compute_vm_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#VirtualMachinesOperations.{}', - client_factory=cf_vm - ) - - compute_vm_extension_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#VirtualMachineExtensionsOperations.{}', - client_factory=cf_vm_ext - ) - - compute_vm_extension_image_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#VirtualMachineExtensionImagesOperations.{}', - client_factory=cf_vm_ext_image - ) - - compute_vm_image_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#VirtualMachineImagesOperations.{}', - client_factory=cf_vm_image - ) - - compute_vm_image_term_sdk = CliCommandType( - operations_tmpl='azure.mgmt.marketplaceordering.operations#MarketplaceAgreementsOperations.{}', - client_factory=cf_vm_image_term - ) - - compute_vm_usage_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#UsageOperations.{}', - client_factory=cf_usage - ) - - compute_vm_run_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#VirtualMachineRunCommandsOperations.{}', - client_factory=cf_run_commands - ) - - compute_vmss_run_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#VirtualMachineScaleSetVmRunCommandsOperations.{}', - client_factory=cf_vmss_run_commands - ) - - compute_vmss_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#VirtualMachineScaleSetsOperations.{}', - client_factory=cf_vmss, - operation_group='virtual_machine_scale_sets' - ) - - compute_gallery_images_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#GalleryImagesOperations.{}', - client_factory=cf_gallery_images, - ) - - compute_gallery_image_versions_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#GalleryImageVersionsOperations.{}', - client_factory=cf_gallery_image_versions, - ) - - compute_dedicated_host_sdk = CliCommandType( - operations_tmpl="azure.mgmt.compute.operations#DedicatedHostsOperations.{}", - client_factory=cf_dedicated_hosts, - ) - - compute_dedicated_host_groups_sdk = CliCommandType( - operations_tmpl="azure.mgmt.compute.operations#DedicatedHostGroupsOperations.{}", - client_factory=cf_dedicated_host_groups, - ) - - image_builder_image_templates_sdk = CliCommandType( - operations_tmpl="azure.mgmt.imagebuilder.operations#VirtualMachineImageTemplatesOperations.{}", - client_factory=cf_img_bldr_image_templates, - ) - - monitor_custom = CliCommandType( - operations_tmpl='azure.cli.command_modules.monitor.custom#{}', - exception_handler=monitor_exception_handler - ) - - metric_definitions_sdk = CliCommandType( - operations_tmpl='azure.mgmt.monitor.operations#MetricDefinitionsOperations.{}', - resource_type=ResourceType.MGMT_MONITOR, - client_factory=cf_metric_def, - operation_group='metric_definitions', - exception_handler=monitor_exception_handler - ) - - capacity_reservation_groups_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#CapacityReservationGroupsOperations.{}', - client_factory=cf_capacity_reservation_groups - ) - - capacity_reservations_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#CapacityReservationsOperations.{}', - client_factory=cf_capacity_reservations - ) - - restore_point = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#RestorePointsOperations.{}', - client_factory=cf_restore_point - ) - - restore_point_collection = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#RestorePointCollectionsOperations.{}', - client_factory=cf_restore_point_collection - ) - - community_gallery_image_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#CommunityGalleryImagesOperations.{}', - client_factory=cf_community_gallery_image) - - community_gallery_image_version_sdk = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#CommunityGalleryImageVersionsOperations.{}', - client_factory=cf_community_gallery_image_version) - - with self.command_group('disk', compute_disk_sdk, operation_group='disks', min_api='2017-03-30') as g: - g.custom_command('create', 'create_managed_disk', supports_no_wait=True, table_transformer=transform_disk_create_table_output, validator=process_disk_create_namespace) - - with self.command_group('image', compute_image_sdk, min_api='2016-04-30-preview') as g: - g.custom_command('create', 'create_image', validator=process_image_create_namespace) - - with self.command_group('image builder', image_builder_image_templates_sdk, custom_command_type=image_builder_custom) as g: - g.custom_command('create', 'create_image_template', supports_no_wait=True, supports_local_cache=True, validator=process_image_template_create_namespace) - g.custom_command('list', 'list_image_templates') - g.show_command('show', 'get') - g.command('delete', 'begin_delete') - g.generic_update_command('update', setter_name='begin_create_or_update', supports_local_cache=True) # todo Update fails for now as service does not support updates - g.wait_command('wait') - g.command('run', 'begin_run', supports_no_wait=True) - g.custom_command('show-runs', 'show_build_output') - g.command('cancel', 'begin_cancel') - - with self.command_group('image builder identity', image_builder_image_templates_sdk, custom_command_type=image_builder_custom) as g: - g.custom_command('assign', 'assign_template_identity', supports_local_cache=True) - g.custom_command('remove', 'remove_template_identity', supports_local_cache=True, confirmation=True) - g.custom_show_command('show', 'show_template_identity', supports_local_cache=True) - - with self.command_group('image builder customizer', image_builder_image_templates_sdk, custom_command_type=image_builder_custom) as g: - g.custom_command('add', 'add_template_customizer', supports_local_cache=True, validator=process_img_tmpl_customizer_add_namespace) - g.custom_command('remove', 'remove_template_customizer', supports_local_cache=True) - g.custom_command('clear', 'clear_template_customizer', supports_local_cache=True) - - with self.command_group('image builder output', image_builder_image_templates_sdk, custom_command_type=image_builder_custom) as g: - g.custom_command('add', 'add_template_output', supports_local_cache=True, validator=process_img_tmpl_output_add_namespace) - g.custom_command('remove', 'remove_template_output', supports_local_cache=True) - g.custom_command('clear', 'clear_template_output', supports_local_cache=True) - - with self.command_group('image builder output versioning', image_builder_image_templates_sdk, custom_command_type=image_builder_custom) as g: - g.custom_command('set', 'set_template_output_versioning', supports_local_cache=True) - g.custom_command('remove', 'remove_template_output_versioning', supports_local_cache=True) - g.custom_show_command('show', 'show_template_output_versioning', supports_local_cache=True) - - with self.command_group('image builder validator', image_builder_image_templates_sdk, custom_command_type=image_builder_custom) as g: - g.custom_command('add', 'add_template_validator', supports_local_cache=True) - g.custom_command('remove', 'remove_template_validator', supports_local_cache=True) - g.custom_show_command('show', 'show_template_validator', supports_local_cache=True) - - with self.command_group('image builder optimizer', image_builder_image_templates_sdk, custom_command_type=image_builder_custom) as g: - g.custom_command('add', 'add_or_update_template_optimizer', supports_local_cache=True) - g.custom_command('update', 'add_or_update_template_optimizer', supports_local_cache=True) - g.custom_command('remove', 'remove_template_optimizer', supports_local_cache=True) - g.custom_show_command('show', 'show_template_optimizer', supports_local_cache=True) - - with self.command_group('image builder error-handler', image_builder_image_templates_sdk, custom_command_type=image_builder_custom) as g: - g.custom_command('add', 'add_template_error_handler', supports_local_cache=True) - g.custom_command('remove', 'remove_template_error_handler', supports_local_cache=True) - g.custom_show_command('show', 'show_template_error_handler', supports_local_cache=True) - - with self.command_group('snapshot', compute_snapshot_sdk, operation_group='snapshots', min_api='2016-04-30-preview') as g: - g.custom_command('create', 'create_snapshot', validator=process_snapshot_create_namespace, supports_no_wait=True) - - with self.command_group('vm', compute_vm_sdk) as g: - g.custom_command('identity assign', 'assign_vm_identity', validator=process_assign_identity_namespace) - g.custom_command('identity remove', 'remove_vm_identity', validator=process_remove_identity_namespace, min_api='2017-12-01') - g.custom_show_command('identity show', 'show_vm_identity') - - g.custom_command('capture', 'capture_vm') - g.custom_command('create', 'create_vm', transform=transform_vm_create_output, supports_no_wait=True, table_transformer=deployment_validate_table_format, validator=process_vm_create_namespace, exception_handler=handle_template_based_exception) - g.command('delete', 'begin_delete', confirmation=True, supports_no_wait=True) - g.custom_command('get-instance-view', 'get_instance_view', table_transformer='{Name:name, ResourceGroup:resourceGroup, Location:location, ProvisioningState:provisioningState, PowerState:instanceView.statuses[1].displayStatus}') - g.custom_command('list', 'list_vm', table_transformer=transform_vm_list) - g.custom_command('list-ip-addresses', 'list_vm_ip_addresses', table_transformer=transform_ip_addresses) - g.custom_command('list-skus', 'list_skus', table_transformer=transform_sku_for_table_output, min_api='2017-03-30') - g.command('list-usage', 'list', command_type=compute_vm_usage_sdk, transform=transform_vm_usage_list, table_transformer='[].{Name:localName, CurrentValue:currentValue, Limit:limit}') - g.custom_command('open-port', 'open_vm_port') - g.custom_command('resize', 'resize_vm', supports_no_wait=True) - g.custom_command('restart', 'restart_vm', supports_no_wait=True) - g.custom_show_command('show', 'show_vm', table_transformer=transform_vm) - g.command('stop', 'begin_power_off', supports_no_wait=True, validator=process_vm_vmss_stop) - g.generic_update_command('update', getter_name='get_vm_to_update', setter_name='update_vm', setter_type=compute_custom, command_type=compute_custom, supports_no_wait=True, validator=process_vm_update_namespace) - g.wait_command('wait', getter_name='get_instance_view', getter_type=compute_custom) - g.custom_command('auto-shutdown', 'auto_shutdown_vm') - - with self.command_group('vm', compute_vm_sdk, client_factory=cf_vm) as g: - g.custom_command('install-patches', 'install_vm_patches', supports_no_wait=True, min_api='2020-12-01') - - with self.command_group('vm availability-set', compute_availset_profile) as g: - g.custom_command('create', 'create_av_set', table_transformer=deployment_validate_table_format, supports_no_wait=True, exception_handler=handle_template_based_exception) - - with self.command_group('vm boot-diagnostics', compute_vm_sdk) as g: - g.custom_command('disable', 'disable_boot_diagnostics') - g.custom_command('enable', 'enable_boot_diagnostics') - g.custom_command('get-boot-log', 'get_boot_log') - g.custom_command('get-boot-log-uris', 'get_boot_log_uris', min_api='2020-06-01') - - with self.command_group('vm diagnostics', compute_vm_sdk) as g: - g.custom_command('set', 'set_diagnostics_extension') - g.custom_command('get-default-config', 'show_default_diagnostics_configuration') - - with self.command_group('vm disk', compute_vm_sdk, min_api='2017-03-30') as g: - g.custom_command('attach', 'attach_managed_data_disk', validator=process_vm_disk_attach_namespace) - g.custom_command('detach', 'detach_managed_data_disk', validator=process_vm_disk_detach_namespace) - - with self.command_group('vm encryption', custom_command_type=compute_disk_encryption_custom) as g: - g.custom_command('enable', 'encrypt_vm', validator=process_disk_encryption_namespace) - g.custom_command('disable', 'decrypt_vm') - g.custom_show_command('show', 'show_vm_encryption_status', table_transformer=transform_vm_encryption_show_table_output) - - with self.command_group('vm extension', compute_vm_extension_sdk) as g: - g.custom_show_command('show', 'show_extensions', table_transformer=transform_extension_show_table_output) - g.custom_command('set', 'set_extension', supports_no_wait=True) - g.custom_command('list', 'list_extensions', table_transformer='[].' + transform_extension_show_table_output) - g.wait_command('wait') - - with self.command_group('vm extension image', compute_vm_extension_image_sdk) as g: - g.custom_command('list', 'list_vm_extension_images') - - with self.command_group('vm image', compute_vm_image_sdk) as g: - g.custom_command('list', 'list_vm_images') - g.custom_show_command('show', 'show_vm_image') - g.custom_command('accept-terms', 'accept_market_ordering_terms', - deprecate_info=g.deprecate(redirect='az vm image terms accept', expiration='3.0.0')) - - with self.command_group('vm image terms', compute_vm_image_term_sdk, validator=None) as g: - g.custom_command('accept', 'accept_terms') - g.custom_command('cancel', 'cancel_terms') - g.custom_show_command('show', 'get_terms') - - with self.command_group('vm nic', compute_vm_sdk) as g: - g.custom_command('add', 'add_vm_nic') - g.custom_command('remove', 'remove_vm_nic') - g.custom_command('set', 'set_vm_nic') - g.custom_show_command('show', 'show_vm_nic') - g.custom_command('list', 'list_vm_nics') - - with self.command_group('vm run-command', compute_vm_run_sdk, client_factory=cf_run_commands, operation_group='virtual_machine_run_commands', min_api='2017-03-30') as g: - g.custom_command('invoke', 'vm_run_command_invoke', supports_no_wait=True) - g.custom_command('list', 'vm_run_command_list') - g.custom_show_command('show', 'vm_run_command_show') - g.custom_command('create', 'vm_run_command_create', supports_no_wait=True) - g.custom_command('update', 'vm_run_command_update', supports_no_wait=True) - g.custom_command('delete', 'vm_run_command_delete', supports_no_wait=True, confirmation=True) - g.custom_wait_command('wait', 'vm_run_command_show') - - with self.command_group('vm secret', compute_vm_sdk) as g: - g.custom_command('format', 'get_vm_format_secret', validator=process_vm_secret_format) - g.custom_command('add', 'add_vm_secret') - g.custom_command('list', 'list_vm_secrets') - g.custom_command('remove', 'remove_vm_secret') - - with self.command_group('vm unmanaged-disk', compute_vm_sdk) as g: - g.custom_command('attach', 'attach_unmanaged_data_disk') - g.custom_command('detach', 'detach_unmanaged_data_disk') - g.custom_command('list', 'list_unmanaged_disks') - - with self.command_group('vm user', compute_vm_sdk, supports_no_wait=True) as g: - g.custom_command('update', 'set_user') - g.custom_command('delete', 'delete_user') - g.custom_command('reset-ssh', 'reset_linux_ssh') - - with self.command_group('vm host', compute_dedicated_host_sdk, client_factory=cf_dedicated_hosts, - min_api='2019-03-01') as g: - g.custom_command('get-instance-view', 'get_dedicated_host_instance_view') - g.custom_command('create', 'create_dedicated_host') - g.generic_update_command('update', setter_name='begin_create_or_update') - - with self.command_group('vm host group', compute_dedicated_host_groups_sdk, client_factory=cf_dedicated_host_groups, - min_api='2019-03-01') as g: - g.custom_command('get-instance-view', 'get_dedicated_host_group_instance_view', min_api='2020-06-01') - g.custom_command('create', 'create_dedicated_host_group') - g.generic_update_command('update') - - with self.command_group('vmss', compute_vmss_sdk, operation_group='virtual_machine_scale_sets') as g: - g.custom_command('identity assign', 'assign_vmss_identity', validator=process_assign_identity_namespace) - g.custom_command('identity remove', 'remove_vmss_identity', validator=process_remove_identity_namespace, min_api='2017-12-01', is_preview=True) - g.custom_show_command('identity show', 'show_vmss_identity') - g.custom_command('application set', 'set_vmss_applications', validator=process_set_applications_namespace, min_api='2021-07-01') - g.custom_command('application list', 'list_vmss_applications', min_api='2021-07-01') - g.custom_command('create', 'create_vmss', transform=DeploymentOutputLongRunningOperation(self.cli_ctx, 'Starting vmss create'), supports_no_wait=True, table_transformer=deployment_validate_table_format, validator=process_vmss_create_namespace, exception_handler=handle_template_based_exception) - g.custom_command('deallocate', 'deallocate_vmss', supports_no_wait=True) - g.custom_command('delete-instances', 'delete_vmss_instances', supports_no_wait=True) - g.custom_command('get-instance-view', 'get_vmss_instance_view', table_transformer='{ProvisioningState:statuses[0].displayStatus, PowerState:statuses[1].displayStatus}') - g.custom_command('list-instance-connection-info', 'list_vmss_instance_connection_info') - g.custom_command('list-instance-public-ips', 'list_vmss_instance_public_ips') - g.custom_command('reimage', 'reimage_vmss', supports_no_wait=True, min_api='2017-03-30') - g.custom_command('restart', 'restart_vmss', supports_no_wait=True) - g.custom_command('scale', 'scale_vmss', supports_no_wait=True) - g.custom_show_command('show', 'get_vmss', table_transformer=get_vmss_table_output_transformer(self, False)) - g.custom_command('start', 'start_vmss', supports_no_wait=True) - g.custom_command('stop', 'stop_vmss', supports_no_wait=True, validator=process_vm_vmss_stop) - g.generic_update_command('update', getter_name='get_vmss_modified', setter_name='update_vmss', supports_no_wait=True, command_type=compute_custom, validator=validate_vmss_update_namespace) - g.custom_command('update-instances', 'update_vmss_instances', supports_no_wait=True) - g.wait_command('wait', getter_name='get_vmss', getter_type=compute_custom) - g.custom_command('set-orchestration-service-state', 'set_orchestration_service_state', supports_no_wait=True) - - with self.command_group('vmss diagnostics', compute_vmss_sdk) as g: - g.custom_command('set', 'set_vmss_diagnostics_extension') - g.custom_command('get-default-config', 'show_default_diagnostics_configuration') - - with self.command_group('vmss disk', compute_vmss_sdk, min_api='2017-03-30') as g: - g.custom_command('attach', 'attach_managed_data_disk_to_vmss') - g.custom_command('detach', 'detach_disk_from_vmss') - - with self.command_group('vmss encryption', custom_command_type=compute_disk_encryption_custom, min_api='2017-03-30') as g: - g.custom_command('enable', 'encrypt_vmss', validator=process_disk_encryption_namespace) - g.custom_command('disable', 'decrypt_vmss') - g.custom_show_command('show', 'show_vmss_encryption_status') - - with self.command_group('vmss extension', compute_vmss_sdk) as g: - g.custom_command('delete', 'delete_vmss_extension', supports_no_wait=True) - g.custom_show_command('show', 'get_vmss_extension') - g.custom_command('set', 'set_vmss_extension', supports_no_wait=True) - g.custom_command('list', 'list_vmss_extensions') - g.custom_command('upgrade', 'upgrade_vmss_extension', min_api='2020-06-01', supports_no_wait=True) - - with self.command_group('vmss extension image', compute_vm_extension_image_sdk) as g: - g.custom_command('list', 'list_vm_extension_images') - - with self.command_group('vmss run-command', compute_vmss_run_sdk, client_factory=cf_vmss_run_commands, min_api='2018-04-01') as g: - g.custom_command('invoke', 'vmss_run_command_invoke') - g.custom_command('list', 'vmss_run_command_list') - g.custom_show_command('show', 'vmss_run_command_show') - g.custom_command('create', 'vmss_run_command_create', supports_no_wait=True) - g.custom_command('update', 'vmss_run_command_update', supports_no_wait=True) - g.custom_command('delete', 'vmss_run_command_delete', supports_no_wait=True, confirmation=True) - - with self.command_group('sig image-definition', community_gallery_image_sdk, client_factory=cf_community_gallery_image, operation_group='shared_galleries', min_api='2022-01-03') as g: - g.command('show-community', 'get') - g.custom_command('list-community', 'sig_community_image_definition_list') - - with self.command_group('sig image-version', community_gallery_image_version_sdk, client_factory=cf_community_gallery_image_version, operation_group='shared_galleries', min_api='2022-01-03') as g: - g.custom_command('list-community', 'sig_community_image_version_list') - - with self.command_group('sig image-definition', compute_gallery_images_sdk, operation_group='gallery_images', min_api='2018-06-01') as g: - g.custom_command('create', 'create_gallery_image') - - with self.command_group('sig image-version', compute_gallery_image_versions_sdk, operation_group='gallery_image_versions', min_api='2018-06-01') as g: - g.custom_command('create', 'create_image_version', supports_no_wait=True, validator=process_image_version_create_namespace) - g.custom_command('undelete', 'undelete_image_version', supports_no_wait=True, min_api='2021-07-01', validator=process_image_version_undelete_namespace, is_preview=True) - g.generic_update_command('update', getter_name='get_image_version_to_update', setter_arg_name='gallery_image_version', setter_name='update_image_version', setter_type=compute_custom, command_type=compute_custom, supports_no_wait=True, validator=process_image_version_update_namespace) - - vm_shared_gallery_image = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations._shared_gallery_images_operations#SharedGalleryImagesOperations.' - '{}', - client_factory=cf_shared_gallery_image, - operation_group='shared_galleries') - with self.command_group('sig image-definition', vm_shared_gallery_image, min_api='2020-09-30', operation_group='shared_galleries', - client_factory=cf_shared_gallery_image) as g: - g.custom_command('list-shared', 'sig_shared_image_definition_list') - - vm_shared_gallery_image_version = CliCommandType( - operations_tmpl='azure.mgmt.compute.operations#SharedGalleryImageVersionsOperations.{}', - client_factory=cf_shared_gallery_image_version, - operation_group='shared_galleries') - with self.command_group('sig image-version', vm_shared_gallery_image_version, min_api='2020-09-30', - operation_group='shared_galleries', - client_factory=cf_shared_gallery_image_version) as g: - g.custom_command('list-shared', 'sig_shared_image_version_list') - - with self.command_group('vm monitor log', client_factory=cf_log_analytics_data_plane) as g: - g.custom_command('show', 'execute_query_for_vm', transform=transform_log_analytics_query_output) # pylint: disable=show-command - - with self.command_group('vm monitor metrics', custom_command_type=monitor_custom, command_type=metric_definitions_sdk, resource_type=ResourceType.MGMT_MONITOR, operation_group='metric_definitions', min_api='2018-01-01', is_preview=True) as g: - from azure.cli.command_modules.monitor.transformers import metrics_table, metrics_definitions_table - from azure.cli.core.profiles._shared import APIVersionException - try: - g.custom_command('tail', 'list_metrics', command_type=monitor_custom, table_transformer=metrics_table) - g.command('list-definitions', 'list', table_transformer=metrics_definitions_table) - except APIVersionException: - pass - - with self.command_group('capacity reservation group', capacity_reservation_groups_sdk, min_api='2021-04-01', - client_factory=cf_capacity_reservation_groups) as g: - g.custom_command('create', 'create_capacity_reservation_group') - g.custom_command('update', 'update_capacity_reservation_group') - g.custom_show_command('show', 'show_capacity_reservation_group') - - with self.command_group('capacity reservation', capacity_reservations_sdk, min_api='2021-04-01', - client_factory=cf_capacity_reservations) as g: - g.custom_command('create', 'create_capacity_reservation', supports_no_wait=True) - g.custom_command('update', 'update_capacity_reservation', supports_no_wait=True) - g.custom_show_command('show', 'show_capacity_reservation') - - with self.command_group('restore-point', restore_point, client_factory=cf_restore_point, min_api='2021-03-01') as g: - g.custom_show_command('show', 'restore_point_show') - g.custom_command('create', 'restore_point_create', supports_no_wait=True) - g.wait_command('wait') - - with self.command_group('restore-point collection', restore_point_collection, min_api='2021-03-01', - client_factory=cf_restore_point_collection) as g: - g.custom_show_command('show', 'restore_point_collection_show') - g.custom_command('create', 'restore_point_collection_create') - g.custom_command('update', 'restore_point_collection_update') - g.wait_command('wait') diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/custom.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/custom.py deleted file mode 100644 index c3690122aca..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/custom.py +++ /dev/null @@ -1,5721 +0,0 @@ -# -------------------------------------------------------------------------- -# 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. -# -# Generation mode: Incremental -# -------------------------------------------------------------------------- - -# pylint: disable=no-self-use, too-many-lines, no-else-return -# pylint: disable=protected-access -import json -import os -from urllib.parse import urlparse -# the urlopen is imported for automation purpose -from urllib.request import urlopen # noqa, pylint: disable=import-error,unused-import,ungrouped-imports - -import requests -from knack.log import get_logger -from knack.util import CLIError - -from azure.cli.command_modules.vm.azure_stack._validators import _get_resource_group_from_vault_name -from azure.cli.core.azclierror import ( - CLIInternalError, - ResourceNotFoundError, - ValidationError, - RequiredArgumentMissingError, - ArgumentUsageError -) -from azure.cli.core.commands import LongRunningOperation, DeploymentOutputLongRunningOperation -from azure.cli.core.commands.client_factory import get_mgmt_service_client, get_data_service_client -from azure.cli.core.commands.validators import validate_file_or_dict -from azure.cli.core.profiles import ResourceType -from azure.cli.core.util import sdk_no_wait -from ._actions import (load_images_from_aliases_doc, load_extension_images_thru_services, - load_images_thru_services, _get_latest_image_version) -from ._client_factory import (_compute_client_factory, cf_vm_image_term) -from ._vm_diagnostics_templates import get_default_diag_config -from ._vm_utils import read_content_if_is_file, import_aaz_by_profile -from ..aaz.latest.vm.disk import AttachDetachDataDisk - -from ..generated.custom import * # noqa: F403, pylint: disable=unused-wildcard-import,wildcard-import -try: - from ..manual.custom import * # noqa: F403, pylint: disable=unused-wildcard-import,wildcard-import -except ImportError: - pass - -logger = get_logger(__name__) - -# Use the same name by portal, so people can update from both cli and portal -# (VM doesn't allow multiple handlers for the same extension) -_ACCESS_EXT_HANDLER_NAME = 'enablevmaccess' - -_LINUX_ACCESS_EXT = 'VMAccessForLinux' -_WINDOWS_ACCESS_EXT = 'VMAccessAgent' -_LINUX_DIAG_EXT = 'LinuxDiagnostic' -_WINDOWS_DIAG_EXT = 'IaaSDiagnostics' -_LINUX_OMS_AGENT_EXT = 'OmsAgentForLinux' -_WINDOWS_OMS_AGENT_EXT = 'MicrosoftMonitoringAgent' -extension_mappings = { - _LINUX_ACCESS_EXT: { - 'version': '1.5', - 'publisher': 'Microsoft.OSTCExtensions' - }, - _WINDOWS_ACCESS_EXT: { - 'version': '2.4', - 'publisher': 'Microsoft.Compute' - }, - _LINUX_DIAG_EXT: { - 'version': '3.0', - 'publisher': 'Microsoft.Azure.Diagnostics' - }, - _WINDOWS_DIAG_EXT: { - 'version': '1.5', - 'publisher': 'Microsoft.Azure.Diagnostics' - }, - _LINUX_OMS_AGENT_EXT: { - 'version': '1.0', - 'publisher': 'Microsoft.EnterpriseCloud.Monitoring' - }, - _WINDOWS_OMS_AGENT_EXT: { - 'version': '1.0', - 'publisher': 'Microsoft.EnterpriseCloud.Monitoring' - } -} - -remove_basic_option_msg = "It's recommended to create with `%s`. " \ - "Please be aware that Basic option will be removed in the future." - - -def _construct_identity_info(identity_scope, identity_role, implicit_identity, external_identities): - info = {} - if identity_scope: - info['scope'] = identity_scope - info['role'] = str(identity_role) # could be DefaultStr, so convert to string - info['userAssignedIdentities'] = external_identities or {} - info['systemAssignedIdentity'] = implicit_identity or '' - return info - - -# for injecting test seams to produce predicatable role assignment id for playback -def _gen_guid(): - import uuid - return uuid.uuid4() - - -def _get_access_extension_upgrade_info(extensions, name): - version = extension_mappings[name]['version'] - publisher = extension_mappings[name]['publisher'] - - auto_upgrade = None - - if extensions: - extension = next((e for e in extensions if e.name == name), None) - from packaging.version import parse # pylint: disable=no-name-in-module,import-error - if extension and parse(extension.type_handler_version) < parse(version): - auto_upgrade = True - elif extension and parse(extension.type_handler_version) > parse(version): - version = extension.type_handler_version - - return publisher, version, auto_upgrade - - -def _get_extension_instance_name(instance_view, publisher, extension_type_name, - suggested_name=None): - extension_instance_name = suggested_name or extension_type_name - full_type_name = '.'.join([publisher, extension_type_name]) - if instance_view.extensions: - ext = next((x for x in instance_view.extensions - if x.type and (x.type.lower() == full_type_name.lower())), None) - if ext: - extension_instance_name = ext.name - return extension_instance_name - - -def _get_storage_management_client(cli_ctx): - return get_mgmt_service_client(cli_ctx, ResourceType.MGMT_STORAGE) - - -def _get_disk_lun(data_disks): - # start from 0, search for unused int for lun - if not data_disks: - return 0 - - existing_luns = sorted([d.lun for d in data_disks]) - for i, current in enumerate(existing_luns): - if current != i: - return i - return len(existing_luns) - - -def _get_private_config(cli_ctx, resource_group_name, storage_account): - storage_mgmt_client = _get_storage_management_client(cli_ctx) - # pylint: disable=no-member - keys = storage_mgmt_client.storage_accounts.list_keys(resource_group_name, storage_account).keys - - private_config = { - 'storageAccountName': storage_account, - 'storageAccountKey': keys[0].value - } - return private_config - - -def _get_resource_group_location(cli_ctx, resource_group_name): - client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES) - # pylint: disable=no-member - return client.resource_groups.get(resource_group_name).location - - -def _get_sku_object(cmd, sku): - if cmd.supported_api_version(min_api='2017-03-30'): - DiskSku = cmd.get_models('DiskSku') - return DiskSku(name=sku) - return sku - - -def get_hyper_v_generation_from_vmss(cli_ctx, image_ref, location): # pylint: disable=too-many-return-statements - from ._vm_utils import (is_valid_image_version_id, parse_gallery_image_id, is_valid_vm_image_id, parse_vm_image_id, - parse_shared_gallery_image_id, parse_community_gallery_image_id) - if image_ref is None: - return None - if image_ref.id: - from ._client_factory import _compute_client_factory - if is_valid_image_version_id(image_ref.id): - image_info = parse_gallery_image_id(image_ref.id) - client = _compute_client_factory(cli_ctx, subscription_id=image_info[0]).gallery_images - gallery_image_info = client.get( - resource_group_name=image_info[1], gallery_name=image_info[2], gallery_image_name=image_info[3]) - return gallery_image_info.hyper_v_generation if hasattr(gallery_image_info, 'hyper_v_generation') else None - if is_valid_vm_image_id(image_ref.id): - sub, rg, image_name = parse_vm_image_id(image_ref.id) - client = _compute_client_factory(cli_ctx, subscription_id=sub).images - image_info = client.get(rg, image_name) - return image_info.hyper_v_generation if hasattr(image_info, 'hyper_v_generation') else None - - if image_ref.shared_gallery_image_id is not None: - from ._client_factory import cf_shared_gallery_image - image_info = parse_shared_gallery_image_id(image_ref.shared_gallery_image_id) - gallery_image_info = cf_shared_gallery_image(cli_ctx).get( - location=location, gallery_unique_name=image_info[0], gallery_image_name=image_info[1]) - return gallery_image_info.hyper_v_generation if hasattr(gallery_image_info, 'hyper_v_generation') else None - - if image_ref.community_gallery_image_id is not None: - from ._client_factory import cf_community_gallery_image - image_info = parse_community_gallery_image_id(image_ref.community_gallery_image_id) - gallery_image_info = cf_community_gallery_image(cli_ctx).get( - location=location, public_gallery_name=image_info[0], gallery_image_name=image_info[1]) - return gallery_image_info.hyper_v_generation if hasattr(gallery_image_info, 'hyper_v_generation') else None - - if image_ref.offer and image_ref.publisher and image_ref.sku and image_ref.version: - from ._client_factory import cf_vm_image - version = image_ref.version - if version.lower() == 'latest': - from ._actions import _get_latest_image_version - version = _get_latest_image_version(cli_ctx, location, image_ref.publisher, image_ref.offer, - image_ref.sku) - vm_image_info = cf_vm_image(cli_ctx, '').get( - location, image_ref.publisher, image_ref.offer, image_ref.sku, version) - return vm_image_info.hyper_v_generation if hasattr(vm_image_info, 'hyper_v_generation') else None - - return None - - -def _is_linux_os(vm): - os_type = None - if vm and vm.storage_profile and vm.storage_profile.os_disk and vm.storage_profile.os_disk.os_type: - os_type = vm.storage_profile.os_disk.os_type - if os_type: - return os_type.lower() == 'linux' - # the os_type could be None for VM scaleset, let us check out os configurations - if vm.os_profile.linux_configuration: - return bool(vm.os_profile.linux_configuration) - return False - - -def _merge_secrets(secrets): - """ - Merge a list of secrets. Each secret should be a dict fitting the following JSON structure: - [{ "sourceVault": { "id": "value" }, - "vaultCertificates": [{ "certificateUrl": "value", - "certificateStore": "cert store name (only on windows)"}] }] - The array of secrets is merged on sourceVault.id. - :param secrets: - :return: - """ - merged = {} - vc_name = 'vaultCertificates' - for outer in secrets: - for secret in outer: - if secret['sourceVault']['id'] not in merged: - merged[secret['sourceVault']['id']] = [] - merged[secret['sourceVault']['id']] = \ - secret[vc_name] + merged[secret['sourceVault']['id']] - - # transform the reduced map to vm format - formatted = [{'sourceVault': {'id': source_id}, - 'vaultCertificates': value} - for source_id, value in list(merged.items())] - return formatted - - -def _normalize_extension_version(cli_ctx, publisher, vm_extension_name, version, location): - def _trim_away_build_number(version): - # workaround a known issue: the version must only contain "major.minor", even though - # "extension image list" gives more detail - return '.'.join(version.split('.')[0:2]) - - if not version: - result = load_extension_images_thru_services(cli_ctx, publisher, vm_extension_name, None, location, - show_latest=True, partial_match=False) - if not result: - raise CLIError('Failed to find the latest version for the extension "{}"'.format(vm_extension_name)) - # with 'show_latest' enabled, we will only get one result. - version = result[0]['version'] - - version = _trim_away_build_number(version) - return version - - -def _parse_rg_name(strid): - '''From an ID, extract the contained (resource group, name) tuple.''' - from azure.mgmt.core.tools import parse_resource_id - parts = parse_resource_id(strid) - return (parts['resource_group'], parts['name']) - - -def _set_sku(cmd, instance, sku): - if cmd.supported_api_version(min_api='2017-03-30'): - instance.sku = cmd.get_models('DiskSku')(name=sku) - else: - instance.account_type = sku - - -def _show_missing_access_warning(resource_group, name, command): - warn = ("No access was given yet to the '{1}', because '--scope' was not provided. " - "You should setup by creating a role assignment, e.g. " - "'az role assignment create --assignee --role contributor -g {0}' " - "would let it access the current resource group. To get the pricipal id, run " - "'az {2} show -g {0} -n {1} --query \"identity.principalId\" -otsv'".format(resource_group, name, command)) - logger.warning(warn) - - -def _parse_aux_subscriptions(resource_id): - from azure.mgmt.core.tools import is_valid_resource_id, parse_resource_id - if is_valid_resource_id(resource_id): - res = parse_resource_id(resource_id) - return [res['subscription']] - return None - - -# Hide extension information from output as the info is not correct and unhelpful; also -# commands using it mean to hide the extension concept from users. -class ExtensionUpdateLongRunningOperation(LongRunningOperation): # pylint: disable=too-few-public-methods - pass - - -# region Disks (Managed) -def create_managed_disk(cmd, resource_group_name, disk_name, location=None, # pylint: disable=too-many-locals, too-many-branches, too-many-statements, line-too-long - size_gb=None, sku='Premium_LRS', os_type=None, - source=None, for_upload=None, upload_size_bytes=None, # pylint: disable=unused-argument - # below are generated internally from 'source' - source_blob_uri=None, source_disk=None, source_snapshot=None, source_restore_point=None, - source_storage_account_id=None, no_wait=False, tags=None, zone=None, - disk_iops_read_write=None, disk_mbps_read_write=None, hyper_v_generation=None, - encryption_type=None, disk_encryption_set=None, max_shares=None, - disk_iops_read_only=None, disk_mbps_read_only=None, - image_reference=None, image_reference_lun=None, - gallery_image_reference=None, gallery_image_reference_lun=None, - network_access_policy=None, disk_access=None, logical_sector_size=None, - tier=None, enable_bursting=None, edge_zone=None, security_type=None, support_hibernation=None, - public_network_access=None, accelerated_network=None, architecture=None, - data_access_auth_mode=None, gallery_image_reference_type=None, security_data_uri=None, - upload_type=None, secure_vm_disk_encryption_set=None, performance_plus=None, - optimized_for_frequent_attach=None): - - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - if security_data_uri: - option = 'ImportSecure' - elif source_blob_uri: - option = 'Import' - elif source_disk or source_snapshot: - option = 'Copy' - elif source_restore_point: - option = 'Restore' - elif upload_type == 'Upload': - option = 'Upload' - elif upload_type == 'UploadWithSecurityData': - option = 'UploadPreparedSecure' - elif image_reference or gallery_image_reference: - option = 'FromImage' - else: - option = 'Empty' - - if source_storage_account_id is None and source_blob_uri is not None: - subscription_id = get_subscription_id(cmd.cli_ctx) - storage_account_name = source_blob_uri.split('.')[0].split('/')[-1] - source_storage_account_id = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Storage', type='storageAccounts', name=storage_account_name) - - if upload_size_bytes is not None and not upload_type: - raise RequiredArgumentMissingError( - 'usage error: --upload-size-bytes should be used together with --upload-type') - - from ._constants import COMPATIBLE_SECURITY_TYPE_VALUE, UPGRADE_SECURITY_HINT - if image_reference is not None: - if not is_valid_resource_id(image_reference): - # URN or name - terms = image_reference.split(':') - if len(terms) == 4: # URN - disk_publisher, disk_offer, disk_sku, disk_version = terms[0], terms[1], terms[2], terms[3] - if disk_version.lower() == 'latest': - disk_version = _get_latest_image_version(cmd.cli_ctx, location, disk_publisher, disk_offer, - disk_sku) - else: # error - raise CLIError('usage error: --image-reference should be ID or URN (publisher:offer:sku:version).') - else: - from azure.mgmt.core.tools import parse_resource_id - terms = parse_resource_id(image_reference) - disk_publisher, disk_offer, disk_sku, disk_version = \ - terms['child_name_1'], terms['child_name_3'], terms['child_name_4'], terms['child_name_5'] - - client = _compute_client_factory(cmd.cli_ctx) - response = client.virtual_machine_images.get(location=location, publisher_name=disk_publisher, - offer=disk_offer, skus=disk_sku, version=disk_version) - - if hasattr(response, 'hyper_v_generation'): - if response.hyper_v_generation == 'V1': - logger.warning(UPGRADE_SECURITY_HINT) - elif response.hyper_v_generation == 'V2': - # set default value of hyper_v_generation - if hyper_v_generation == 'V1': - hyper_v_generation = 'V2' - # set default value of security_type - if not security_type: - security_type = 'TrustedLaunch' - if security_type != 'TrustedLaunch': - logger.warning(UPGRADE_SECURITY_HINT) - - # image_reference is an ID now - image_reference = {'id': response.id} - if image_reference_lun is not None: - image_reference['lun'] = image_reference_lun - - if gallery_image_reference is not None: - if not security_type: - security_type = 'Standard' - if security_type != 'TrustedLaunch': - logger.warning(UPGRADE_SECURITY_HINT) - - key = gallery_image_reference_type if gallery_image_reference_type else 'id' - gallery_image_reference = {key: gallery_image_reference} - if gallery_image_reference_lun is not None: - gallery_image_reference['lun'] = gallery_image_reference_lun - - creation_data = { - "create_option": option, - "source_uri": source_blob_uri, - "image_reference": image_reference, - "gallery_image_reference": gallery_image_reference, - "source_resource_id": source_disk or source_snapshot or source_restore_point, - "storage_account_id": source_storage_account_id, - "upload_size_bytes": upload_size_bytes, - "logical_sector_size": logical_sector_size, - "security_data_uri": security_data_uri, - "performance_plus": performance_plus - } - - if size_gb is None and option == "Empty": - raise RequiredArgumentMissingError( - 'usage error: --size-gb is required to create an empty disk') - if upload_size_bytes is None and upload_type: - raise RequiredArgumentMissingError( - 'usage error: --upload-size-bytes is required to create a disk for upload') - - if disk_encryption_set is not None and not is_valid_resource_id(disk_encryption_set): - disk_encryption_set = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=disk_encryption_set) - - if disk_access is not None and not is_valid_resource_id(disk_access): - disk_access = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskAccesses', name=disk_access) - - if secure_vm_disk_encryption_set is not None and not is_valid_resource_id(secure_vm_disk_encryption_set): - secure_vm_disk_encryption_set = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=secure_vm_disk_encryption_set) - - encryption = None - if disk_encryption_set or encryption_type: - encryption = { - "type": encryption_type, - "disk_encryption_set_id": disk_encryption_set - } - - if cmd.supported_api_version(min_api='2017-03-30'): - sku = {"name": sku} - - args = { - "location": location, - "creation_data": creation_data, - "tags": tags or {}, - "sku": sku, - "disk_size_gb": size_gb, - "os_type": os_type, - "encryption": encryption - } - - if hyper_v_generation: - args["hyper_v_generation"] = hyper_v_generation - - if zone: - args["zones"] = zone - if disk_iops_read_write is not None: - args["disk_iops_read_write"] = disk_iops_read_write - if disk_mbps_read_write is not None: - args["disk_m_bps_read_write"] = disk_mbps_read_write - if max_shares is not None: - args["max_shares"] = max_shares - if disk_iops_read_only is not None: - args["disk_iops_read_only"] = disk_iops_read_only - if disk_mbps_read_only is not None: - args["disk_m_bps_read_only"] = disk_mbps_read_only - if network_access_policy is not None: - args["network_access_policy"] = network_access_policy - if disk_access is not None: - args["disk_access_id"] = disk_access - if tier is not None: - args["tier"] = tier - if enable_bursting is not None: - args["bursting_enabled"] = enable_bursting - if edge_zone is not None: - args["extended_location"] = edge_zone - # The `Standard` is used for backward compatibility to allow customers to keep their current behavior - # after changing the default values to Trusted Launch VMs in the future. - if security_type and security_type != COMPATIBLE_SECURITY_TYPE_VALUE: - args["security_profile"] = {'securityType': security_type} - if secure_vm_disk_encryption_set: - args["security_profile"]["secure_vm_disk_encryption_set_id"] = secure_vm_disk_encryption_set - if support_hibernation is not None: - args["supports_hibernation"] = support_hibernation - if public_network_access is not None: - args["public_network_access"] = public_network_access - if accelerated_network is not None or architecture is not None: - if args.get("supported_capabilities", None) is None: - supported_capabilities = { - "accelerated_network": accelerated_network, - "architecture": architecture - } - args["supported_capabilities"] = supported_capabilities - else: - args["supported_capabilities"]["accelerated_network"] = accelerated_network - args["supported_capabilities"]["architecture"] = architecture - if data_access_auth_mode is not None: - args["data_access_auth_mode"] = data_access_auth_mode - if optimized_for_frequent_attach is not None: - args["optimized_for_frequent_attach"] = optimized_for_frequent_attach - - args["no_wait"] = no_wait - args["disk_name"] = disk_name - args["resource_group"] = resource_group_name - - _Disk = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "disk") - return _Disk.Create(cli_ctx=cmd.cli_ctx)(command_args=args) -# endregion - - -# region Images (Managed) -def create_image(cmd, resource_group_name, name, source, os_type=None, data_disk_sources=None, location=None, # pylint: disable=too-many-locals,unused-argument - # below are generated internally from 'source' and 'data_disk_sources' - source_virtual_machine=None, storage_sku=None, hyper_v_generation=None, - os_blob_uri=None, data_blob_uris=None, - os_snapshot=None, data_snapshots=None, - os_disk=None, os_disk_caching=None, data_disks=None, data_disk_caching=None, - tags=None, zone_resilient=None, edge_zone=None): - if source_virtual_machine: - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - image_storage_profile = None if zone_resilient is None else {"zone_resilient": zone_resilient} - args = { - "location": location, - "source_virtual_machine": {"id": source_virtual_machine}, - "storage_profile": image_storage_profile, - "tags": tags or {} - } - else: - os_disk = { - "os_type": os_type, - "os_state": "Generalized", - "caching": os_disk_caching, - "snapshot": {"id": os_snapshot} if os_snapshot else None, - "managed_disk": {"id": os_disk} if os_disk else None, - "blob_uri": os_blob_uri, - "storage_account_type": storage_sku - } - all_data_disks = [] - lun = 0 - if data_blob_uris: - for d in data_blob_uris: - all_data_disks.append({ - "lun": lun, - "blob_uri": d, - "caching": data_disk_caching - }) - lun += 1 - if data_snapshots: - for d in data_snapshots: - all_data_disks.append({ - "lun": lun, - "snapshot": {"id": d}, - "caching": data_disk_caching - }) - lun += 1 - if data_disks: - for d in data_disks: - all_data_disks.append({ - "lun": lun, - "managed_disk": {"id": d}, - "caching": data_disk_caching - }) - lun += 1 - - image_storage_profile = { - "os_disk": os_disk, - "data_disks": all_data_disks - } - if zone_resilient is not None: - image_storage_profile["zone_resilient"] = zone_resilient - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - # pylint disable=no-member - args = { - "location": location, - "storage_profile": image_storage_profile, - "tags": tags or {} - } - - if hyper_v_generation: - args["hyper_v_generation"] = hyper_v_generation - - if edge_zone: - args["extended_location"] = edge_zone - - args["image_name"] = name - args["resource_group"] = resource_group_name - - _Image = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "image") - return _Image.Create(cli_ctx=cmd.cli_ctx)(command_args=args) - - -# region Snapshots -# pylint: disable=unused-argument,too-many-locals -def create_snapshot(cmd, resource_group_name, snapshot_name, location=None, size_gb=None, sku='Standard_LRS', - source=None, for_upload=None, copy_start=None, incremental=None, - # below are generated internally from 'source' - source_blob_uri=None, source_disk=None, source_snapshot=None, source_storage_account_id=None, - hyper_v_generation=None, tags=None, no_wait=False, disk_encryption_set=None, - encryption_type=None, network_access_policy=None, disk_access=None, edge_zone=None, - public_network_access=None, accelerated_network=None, architecture=None, - elastic_san_resource_id=None, bandwidth_copy_speed=None): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - if source_blob_uri: - option = 'Import' - elif source_disk or source_snapshot: - option = 'CopyStart' if copy_start else 'Copy' - elif for_upload: - option = 'Upload' - elif elastic_san_resource_id: - option = 'CopyFromSanSnapshot' - else: - option = 'Empty' - - creation_data = { - 'create_option': option, - 'source_uri': source_blob_uri, - 'image_reference': None, - 'source_resource_id': source_disk or source_snapshot, - 'storage_account_id': source_storage_account_id, - 'elastic_san_resource_id': elastic_san_resource_id, - 'provisioned_bandwidth_copy_speed': bandwidth_copy_speed, - - } - - if size_gb is None and option == 'Empty': - raise CLIError('Please supply size for the snapshots') - - if disk_encryption_set is not None and not is_valid_resource_id(disk_encryption_set): - disk_encryption_set = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=disk_encryption_set) - - if disk_access is not None and not is_valid_resource_id(disk_access): - disk_access = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskAccesses', name=disk_access) - - if disk_encryption_set is not None and encryption_type is None: - raise CLIError('usage error: Please specify --encryption-type.') - if encryption_type is not None: - encryption = { - 'type': encryption_type, - 'disk_encryption_set_id': disk_encryption_set - } - else: - encryption = None - - args = { - 'location': location, - 'creation_data': creation_data, - 'tags': tags or {}, - 'sku': {'name': sku}, - 'disk_size_gb': size_gb, - 'incremental': incremental, - 'encryption': encryption, - } - - if hyper_v_generation: - args['hyper_v_generation'] = hyper_v_generation - if network_access_policy is not None: - args['network_access_policy'] = network_access_policy - if disk_access is not None: - args['disk_access_id'] = disk_access - if edge_zone: - args['extended_location'] = edge_zone - if public_network_access is not None: - args['public_network_access'] = public_network_access - if accelerated_network is not None or architecture is not None: - if args.get('supported_capabilities', None) is None: - supported_capabilities = { - 'accelerated_network': accelerated_network, - 'architecture': architecture - } - args['supported_capabilities'] = supported_capabilities - else: - args['supported_capabilities']['accelerated_network'] = accelerated_network - args['supported_capabilities']['architecture'] = architecture - - args['snapshot_name'] = snapshot_name - args['resource_group'] = resource_group_name - args['no_wait'] = no_wait - - _Snapshot = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "snapshot") - return _Snapshot.Create(cli_ctx=cmd.cli_ctx)(command_args=args) -# endregion - - -# region VirtualMachines Identity -def show_vm_identity(cmd, resource_group_name, vm_name): - client = _compute_client_factory(cmd.cli_ctx) - return client.virtual_machines.get(resource_group_name, vm_name).identity - - -def show_vmss_identity(cmd, resource_group_name, vm_name): - client = _compute_client_factory(cmd.cli_ctx) - return client.virtual_machine_scale_sets.get(resource_group_name, vm_name).identity - - -def assign_vm_identity(cmd, resource_group_name, vm_name, assign_identity=None, identity_role=None, - identity_role_id=None, identity_scope=None): - VirtualMachineIdentity, ResourceIdentityType, VirtualMachineUpdate = cmd.get_models('VirtualMachineIdentity', - 'ResourceIdentityType', - 'VirtualMachineUpdate') - UserAssignedIdentitiesValue = cmd.get_models('UserAssignedIdentitiesValue') - from azure.cli.core.commands.arm import assign_identity as assign_identity_helper - client = _compute_client_factory(cmd.cli_ctx) - _, _, external_identities, enable_local_identity = _build_identities_info(assign_identity) - - def getter(): - return client.virtual_machines.get(resource_group_name, vm_name) - - def setter(vm, external_identities=external_identities): - if vm.identity and vm.identity.type == ResourceIdentityType.system_assigned_user_assigned: - identity_types = ResourceIdentityType.system_assigned_user_assigned - elif vm.identity and vm.identity.type == ResourceIdentityType.system_assigned and external_identities: - identity_types = ResourceIdentityType.system_assigned_user_assigned - elif vm.identity and vm.identity.type == ResourceIdentityType.user_assigned and enable_local_identity: - identity_types = ResourceIdentityType.system_assigned_user_assigned - elif external_identities and enable_local_identity: - identity_types = ResourceIdentityType.system_assigned_user_assigned - elif external_identities: - identity_types = ResourceIdentityType.user_assigned - else: - identity_types = ResourceIdentityType.system_assigned - - vm.identity = VirtualMachineIdentity(type=identity_types) - if external_identities: - vm.identity.user_assigned_identities = {} - if not cmd.supported_api_version(min_api='2018-06-01', resource_type=ResourceType.MGMT_COMPUTE): - raise CLIInternalError("Usage error: user assigned identity is not available under current profile.", - "You can set the cloud's profile to latest with 'az cloud set --profile latest" - " --name '") - for identity in external_identities: - vm.identity.user_assigned_identities[identity] = UserAssignedIdentitiesValue() - - vm_patch = VirtualMachineUpdate() - vm_patch.identity = vm.identity - return patch_vm(cmd, resource_group_name, vm_name, vm_patch) - - assign_identity_helper(cmd.cli_ctx, getter, setter, identity_role=identity_role_id, identity_scope=identity_scope) - vm = client.virtual_machines.get(resource_group_name, vm_name) - return _construct_identity_info(identity_scope, identity_role, vm.identity.principal_id, - vm.identity.user_assigned_identities) - - -# endregion - - -# region VirtualMachines -def capture_vm(cmd, resource_group_name, vm_name, vhd_name_prefix, - storage_container='vhds', overwrite=True): - VirtualMachineCaptureParameters = cmd.get_models('VirtualMachineCaptureParameters') - client = _compute_client_factory(cmd.cli_ctx) - parameter = VirtualMachineCaptureParameters(vhd_prefix=vhd_name_prefix, - destination_container_name=storage_container, - overwrite_vhds=overwrite) - poller = client.virtual_machines.begin_capture(resource_group_name, vm_name, parameter) - result = LongRunningOperation(cmd.cli_ctx)(poller) - output = getattr(result, 'output', None) or result.resources[0] - print(json.dumps(output, indent=2)) # pylint: disable=no-member - - -# pylint: disable=too-many-locals, unused-argument, too-many-statements, too-many-branches, broad-except -def create_vm(cmd, vm_name, resource_group_name, image=None, size='Standard_DS1_v2', location=None, tags=None, - no_wait=False, authentication_type=None, admin_password=None, computer_name=None, - admin_username=None, ssh_dest_key_path=None, ssh_key_value=None, generate_ssh_keys=False, - availability_set=None, nics=None, nsg=None, nsg_rule=None, accelerated_networking=None, - private_ip_address=None, public_ip_address=None, public_ip_address_allocation='dynamic', - public_ip_address_dns_name=None, public_ip_sku=None, os_disk_name=None, os_type=None, - storage_account=None, os_caching=None, data_caching=None, storage_container_name=None, storage_sku=None, - use_unmanaged_disk=False, attach_os_disk=None, os_disk_size_gb=None, attach_data_disks=None, - data_disk_sizes_gb=None, disk_info=None, - vnet_name=None, vnet_address_prefix='10.0.0.0/16', subnet=None, subnet_address_prefix='10.0.0.0/24', - storage_profile=None, os_publisher=None, os_offer=None, os_sku=None, os_version=None, - storage_account_type=None, vnet_type=None, nsg_type=None, public_ip_address_type=None, nic_type=None, - validate=False, custom_data=None, secrets=None, plan_name=None, plan_product=None, plan_publisher=None, - plan_promotion_code=None, license_type=None, assign_identity=None, identity_scope=None, - identity_role=None, identity_role_id=None, application_security_groups=None, zone=None, - boot_diagnostics_storage=None, ultra_ssd_enabled=None, - ephemeral_os_disk=None, ephemeral_os_disk_placement=None, - proximity_placement_group=None, dedicated_host=None, dedicated_host_group=None, aux_subscriptions=None, - priority=None, max_price=None, eviction_policy=None, enable_agent=None, workspace=None, vmss=None, - os_disk_encryption_set=None, data_disk_encryption_sets=None, specialized=None, - encryption_at_host=None, enable_auto_update=None, patch_mode=None, ssh_key_name=None, - enable_hotpatching=None, platform_fault_domain=None, security_type=None, enable_secure_boot=None, - enable_vtpm=None, count=None, edge_zone=None, nic_delete_option=None, os_disk_delete_option=None, - data_disk_delete_option=None, user_data=None, capacity_reservation_group=None, enable_hibernation=None, - v_cpus_available=None, v_cpus_per_core=None, accept_term=None, - disable_integrity_monitoring=None, # Unused - enable_integrity_monitoring=False, - os_disk_security_encryption_type=None, os_disk_secure_vm_disk_encryption_set=None, - disk_controller_type=None, disable_integrity_monitoring_autoupgrade=False, enable_proxy_agent=None, - proxy_agent_mode=None, source_snapshots_or_disks=None, source_snapshots_or_disks_size_gb=None, - source_disk_restore_point=None, source_disk_restore_point_size_gb=None, ssh_key_type=None): - from azure.cli.core.commands.client_factory import get_subscription_id - from azure.cli.core.util import random_string, hash_string - from azure.cli.core.commands.arm import ArmTemplateBuilder - # pylint: disable=line-too-long - from azure.cli.command_modules.vm.azure_stack._template_builder import (build_vm_resource, - build_storage_account_resource, - build_nic_resource, - build_vnet_resource, build_nsg_resource, - build_public_ip_resource, StorageProfile, - build_msi_role_assignment, - build_vm_linux_log_analytics_workspace_agent, - build_vm_windows_log_analytics_workspace_agent) - from azure.cli.command_modules.vm.azure_stack._vm_utils import ArmTemplateBuilder20190401 - from azure.mgmt.core.tools import resource_id, is_valid_resource_id, parse_resource_id - - # In the latest profile, the default public IP will be expected to be changed from Basic to Standard, - # and Basic option will be removed. - # In order to avoid breaking change which has a big impact to users, - # we use the hint to guide users to use Standard public IP to create VM in the first stage. - if cmd.cli_ctx.cloud.profile == 'latest': - if public_ip_sku == "Basic": - logger.warning(remove_basic_option_msg, "--public-ip-sku Standard") - - subscription_id = get_subscription_id(cmd.cli_ctx) - if os_disk_encryption_set is not None and not is_valid_resource_id(os_disk_encryption_set): - os_disk_encryption_set = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=os_disk_encryption_set) - if os_disk_secure_vm_disk_encryption_set is not None and \ - not is_valid_resource_id(os_disk_secure_vm_disk_encryption_set): - os_disk_secure_vm_disk_encryption_set = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=os_disk_secure_vm_disk_encryption_set) - - if data_disk_encryption_sets is None: - data_disk_encryption_sets = [] - for i, des in enumerate(data_disk_encryption_sets): - if des is not None and not is_valid_resource_id(des): - data_disk_encryption_sets[i] = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=des) - - storage_sku = disk_info['os'].get('storageAccountType') - - network_id_template = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Network') - - vm_id = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='virtualMachines', name=vm_name) - - # determine final defaults and calculated values - tags = tags or {} - os_disk_name = os_disk_name or ('osdisk_{}'.format(hash_string(vm_id, length=10)) if use_unmanaged_disk else None) - storage_container_name = storage_container_name or 'vhds' - - # Build up the ARM template - if count is None: - master_template = ArmTemplateBuilder() - else: - master_template = ArmTemplateBuilder20190401() - - vm_dependencies = [] - if storage_account_type == 'new': - storage_account = storage_account or 'vhdstorage{}'.format( - hash_string(vm_id, length=14, force_lower=True)) - vm_dependencies.append('Microsoft.Storage/storageAccounts/{}'.format(storage_account)) - master_template.add_resource(build_storage_account_resource(cmd, storage_account, location, - tags, storage_sku, edge_zone)) - - nic_name = None - if nic_type == 'new': - nic_name = '{}VMNic'.format(vm_name) - nic_full_name = 'Microsoft.Network/networkInterfaces/{}'.format(nic_name) - if count: - vm_dependencies.extend([nic_full_name + str(i) for i in range(count)]) - else: - vm_dependencies.append(nic_full_name) - - nic_dependencies = [] - if vnet_type == 'new': - subnet = subnet or '{}Subnet'.format(vm_name) - vnet_exists = False - if vnet_name: - from azure.cli.command_modules.vm.azure_stack._vm_utils import check_existence - vnet_exists = \ - check_existence(cmd.cli_ctx, vnet_name, resource_group_name, 'Microsoft.Network', 'virtualNetworks') - if vnet_exists: - SubnetCreate = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.vnet.subnet").Create - try: - poller = SubnetCreate(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': subnet, - 'vnet_name': vnet_name, - 'resource_group': resource_group_name, - 'address_prefixes': [subnet_address_prefix], - 'address_prefix': subnet_address_prefix - }) - LongRunningOperation(cmd.cli_ctx)(poller) - except Exception: - raise CLIError('Subnet({}) does not exist, but failed to create a new subnet with address ' - 'prefix {}. It may be caused by name or address prefix conflict. Please specify ' - 'an appropriate subnet name with --subnet or a valid address prefix value with ' - '--subnet-address-prefix.'.format(subnet, subnet_address_prefix)) - if not vnet_exists: - vnet_name = vnet_name or '{}VNET'.format(vm_name) - nic_dependencies.append('Microsoft.Network/virtualNetworks/{}'.format(vnet_name)) - master_template.add_resource(build_vnet_resource(cmd, vnet_name, location, tags, vnet_address_prefix, - subnet, subnet_address_prefix, edge_zone=edge_zone)) - - if nsg_type == 'new': - if nsg_rule is None: - nsg_rule = 'RDP' if os_type.lower() == 'windows' else 'SSH' - nsg = nsg or '{}NSG'.format(vm_name) - nic_dependencies.append('Microsoft.Network/networkSecurityGroups/{}'.format(nsg)) - master_template.add_resource(build_nsg_resource(cmd, nsg, location, tags, nsg_rule)) - - if public_ip_address_type == 'new': - public_ip_address = public_ip_address or '{}PublicIP'.format(vm_name) - public_ip_address_full_name = 'Microsoft.Network/publicIpAddresses/{}'.format(public_ip_address) - if count: - nic_dependencies.extend([public_ip_address_full_name + str(i) for i in range(count)]) - else: - nic_dependencies.append(public_ip_address_full_name) - master_template.add_resource(build_public_ip_resource(cmd, public_ip_address, location, tags, - public_ip_address_allocation, - public_ip_address_dns_name, - public_ip_sku, zone, count, edge_zone)) - - subnet_id = subnet if is_valid_resource_id(subnet) else \ - '{}/virtualNetworks/{}/subnets/{}'.format(network_id_template, vnet_name, subnet) - - nsg_id = None - if nsg: - nsg_id = nsg if is_valid_resource_id(nsg) else \ - '{}/networkSecurityGroups/{}'.format(network_id_template, nsg) - - public_ip_address_id = None - if public_ip_address: - public_ip_address_id = public_ip_address if is_valid_resource_id(public_ip_address) \ - else '{}/publicIPAddresses/{}'.format(network_id_template, public_ip_address) - - nics_id = '{}/networkInterfaces/{}'.format(network_id_template, nic_name) - - if count: - nics = [ - { - 'id': "[concat('{}', copyIndex())]".format(nics_id), - 'properties': { - 'deleteOption': nic_delete_option - } - } - ] - else: - nics = [ - { - 'id': nics_id, - 'properties': { - 'deleteOption': nic_delete_option - } - } - ] - - nic_resource = build_nic_resource( - cmd, nic_name, location, tags, vm_name, subnet_id, private_ip_address, nsg_id, - public_ip_address_id, application_security_groups, accelerated_networking=accelerated_networking, - count=count, edge_zone=edge_zone) - nic_resource['dependsOn'] = nic_dependencies - master_template.add_resource(nic_resource) - else: - # Using an existing NIC - invalid_parameters = [nsg, public_ip_address, subnet, vnet_name, application_security_groups] - if any(invalid_parameters): - raise CLIError('When specifying an existing NIC, do not specify NSG, ' - 'public IP, ASGs, VNet or subnet.') - if accelerated_networking is not None: - logger.warning('When specifying an existing NIC, do not specify accelerated networking. ' - 'Ignore --accelerated-networking now. ' - 'This will trigger an error instead of a warning in future releases.') - - os_vhd_uri = None - if storage_profile in [StorageProfile.SACustomImage, StorageProfile.SAPirImage]: - storage_account_name = storage_account.rsplit('/', 1) - storage_account_name = storage_account_name[1] if \ - len(storage_account_name) > 1 else storage_account_name[0] - os_vhd_uri = 'https://{}.blob.{}/{}/{}.vhd'.format( - storage_account_name, cmd.cli_ctx.cloud.suffixes.storage_endpoint, storage_container_name, os_disk_name) - elif storage_profile == StorageProfile.SASpecializedOSDisk: - os_vhd_uri = attach_os_disk - os_disk_name = attach_os_disk.rsplit('/', 1)[1][:-4] - - if custom_data: - custom_data = read_content_if_is_file(custom_data) - - if user_data: - user_data = read_content_if_is_file(user_data) - - if secrets: - secrets = _merge_secrets([validate_file_or_dict(secret) for secret in secrets]) - - vm_resource = build_vm_resource( - cmd=cmd, name=vm_name, location=location, tags=tags, size=size, storage_profile=storage_profile, nics=nics, - admin_username=admin_username, availability_set_id=availability_set, admin_password=admin_password, - ssh_key_values=ssh_key_value, ssh_key_path=ssh_dest_key_path, image_reference=image, - os_disk_name=os_disk_name, custom_image_os_type=os_type, authentication_type=authentication_type, - os_publisher=os_publisher, os_offer=os_offer, os_sku=os_sku, os_version=os_version, os_vhd_uri=os_vhd_uri, - attach_os_disk=attach_os_disk, os_disk_size_gb=os_disk_size_gb, custom_data=custom_data, secrets=secrets, - license_type=license_type, zone=zone, disk_info=disk_info, - boot_diagnostics_storage_uri=boot_diagnostics_storage, ultra_ssd_enabled=ultra_ssd_enabled, - proximity_placement_group=proximity_placement_group, computer_name=computer_name, - dedicated_host=dedicated_host, priority=priority, max_price=max_price, eviction_policy=eviction_policy, - enable_agent=enable_agent, vmss=vmss, os_disk_encryption_set=os_disk_encryption_set, - data_disk_encryption_sets=data_disk_encryption_sets, specialized=specialized, - encryption_at_host=encryption_at_host, dedicated_host_group=dedicated_host_group, - enable_auto_update=enable_auto_update, patch_mode=patch_mode, enable_hotpatching=enable_hotpatching, - platform_fault_domain=platform_fault_domain, security_type=security_type, enable_secure_boot=enable_secure_boot, - enable_vtpm=enable_vtpm, count=count, edge_zone=edge_zone, os_disk_delete_option=os_disk_delete_option, - user_data=user_data, capacity_reservation_group=capacity_reservation_group, - enable_hibernation=enable_hibernation, v_cpus_available=v_cpus_available, v_cpus_per_core=v_cpus_per_core, - os_disk_security_encryption_type=os_disk_security_encryption_type, - os_disk_secure_vm_disk_encryption_set=os_disk_secure_vm_disk_encryption_set, - disk_controller_type=disk_controller_type, enable_proxy_agent=enable_proxy_agent, - proxy_agent_mode=proxy_agent_mode) - - vm_resource['dependsOn'] = vm_dependencies - - if plan_name: - vm_resource['plan'] = { - 'name': plan_name, - 'publisher': plan_publisher, - 'product': plan_product, - 'promotionCode': plan_promotion_code - } - - enable_local_identity = None - if assign_identity is not None: - vm_resource['identity'], _, _, enable_local_identity = _build_identities_info(assign_identity) - role_assignment_guid = None - if identity_scope: - role_assignment_guid = str(_gen_guid()) - master_template.add_resource(build_msi_role_assignment(vm_name, vm_id, identity_role_id, - role_assignment_guid, identity_scope)) - - if workspace is not None: - workspace_id = _prepare_workspace(cmd, resource_group_name, workspace) - master_template.add_secure_parameter('workspaceId', workspace_id) - if os_type.lower() == 'linux': - vm_mmaExtension_resource = build_vm_linux_log_analytics_workspace_agent(cmd, vm_name, location) - master_template.add_resource(vm_mmaExtension_resource) - elif os_type.lower() == 'windows': - vm_mmaExtension_resource = build_vm_windows_log_analytics_workspace_agent(cmd, vm_name, location) - master_template.add_resource(vm_mmaExtension_resource) - else: - logger.warning("Unsupported OS type. Skip the connection step for log analytics workspace.") - - master_template.add_resource(vm_resource) - - if admin_password: - master_template.add_secure_parameter('adminPassword', admin_password) - - template = master_template.build() - parameters = master_template.build_parameters() - - # deploy ARM template - deployment_name = 'vm_deploy_' + random_string(32) - client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, - aux_subscriptions=aux_subscriptions).deployments - DeploymentProperties = cmd.get_models('DeploymentProperties', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) - properties = DeploymentProperties(template=template, parameters=parameters, mode='incremental') - Deployment = cmd.get_models('Deployment', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) - deployment = Deployment(properties=properties) - - if validate: - from azure.cli.command_modules.vm.azure_stack._vm_utils import log_pprint_template - log_pprint_template(template) - log_pprint_template(parameters) - - if cmd.supported_api_version(min_api='2019-10-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES): - validation_poller = client.begin_validate(resource_group_name, deployment_name, deployment) - return LongRunningOperation(cmd.cli_ctx)(validation_poller) - - return client.validate(resource_group_name, deployment_name, deployment) - - # creates the VM deployment - if no_wait: - return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, deployment_name, deployment) - LongRunningOperation(cmd.cli_ctx)(client.begin_create_or_update(resource_group_name, deployment_name, deployment)) - - # Guest Attestation Extension and enable System Assigned MSI by default - is_trusted_launch = security_type and security_type.lower() == 'trustedlaunch' and \ - enable_vtpm and enable_secure_boot - if is_trusted_launch and enable_integrity_monitoring: - vm = get_vm(cmd, resource_group_name, vm_name, 'instanceView') - client = _compute_client_factory(cmd.cli_ctx) - if vm.storage_profile.os_disk.os_type == 'Linux': - publisher = 'Microsoft.Azure.Security.LinuxAttestation' - if vm.storage_profile.os_disk.os_type == 'Windows': - publisher = 'Microsoft.Azure.Security.WindowsAttestation' - version = _normalize_extension_version(cmd.cli_ctx, publisher, 'GuestAttestation', None, vm.location) - VirtualMachineExtension = cmd.get_models('VirtualMachineExtension') - ext = VirtualMachineExtension(location=vm.location, - publisher=publisher, - type_properties_type='GuestAttestation', - protected_settings=None, - type_handler_version=version, - settings=None, - auto_upgrade_minor_version=True, - enable_automatic_upgrade=not disable_integrity_monitoring_autoupgrade) - try: - LongRunningOperation(cmd.cli_ctx)(client.virtual_machine_extensions.begin_create_or_update( - resource_group_name, vm_name, 'GuestAttestation', ext)) - logger.info('Guest Attestation Extension has been successfully installed by default ' - 'when Trusted Launch configuration is met') - except Exception as e: - logger.error('Failed to install Guest Attestation Extension for Trusted Launch. %s', e) - if count: - vm_names = [vm_name + str(i) for i in range(count)] - else: - vm_names = [vm_name] - vms = [] - # Use vm_name2 to avoid R1704: Redefining argument with the local name 'vm_name' (redefined-argument-from-local) - for vm_name2 in vm_names: - vm = get_vm_details(cmd, resource_group_name, vm_name2) - if assign_identity is not None: - if enable_local_identity and not identity_scope: - _show_missing_access_warning(resource_group_name, vm_name2, 'vm') - setattr(vm, 'identity', _construct_identity_info(identity_scope, identity_role, vm.identity.principal_id, - vm.identity.user_assigned_identities)) - vms.append(vm) - - if workspace is not None: - workspace_name = parse_resource_id(workspace_id)['name'] - _set_data_source_for_workspace(cmd, os_type, resource_group_name, workspace_name) - - if len(vms) == 1: - return vms[0] - return vms - - -def auto_shutdown_vm(cmd, resource_group_name, vm_name, off=None, email=None, webhook=None, time=None, - location=None): - from ...lab.aaz.latest.lab.global_schedule import Delete as DeleteSchedule, Create as CreateSchedule - from azure.mgmt.core.tools import resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - subscription_id = get_subscription_id(cmd.cli_ctx) - name = 'shutdown-computevm-' + vm_name - vm_id = resource_id(subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='virtualMachines', name=vm_name) - - schedule = { - 'name': name, - 'resource_group': resource_group_name - } - if off: - if email is not None or webhook is not None or time is not None: - # I don't want to disrupt users. So I warn instead of raising an error. - logger.warning('If --off, other parameters will be ignored.') - return DeleteSchedule(cli_ctx=cmd.cli_ctx)(command_args=schedule) - - if time is None: - raise CLIError('usage error: --time is a required parameter') - daily_recurrence = {'time': time} - notification_settings = None - if email or webhook: - notification_settings = { - 'timeInMinutes': 30, - 'status': 'Enabled' - } - if email: - notification_settings['emailRecipient'] = email - if webhook: - notification_settings['webhookUrl'] = webhook - - schedule.update({ - 'status': 'Enabled', - 'target_resource_id': vm_id, - 'daily_recurrence': daily_recurrence, - 'notification_settings': notification_settings, - 'time_zone_id': 'UTC', - 'task_type': 'ComputeVmShutdownTask', - 'location': location - }) - return CreateSchedule(cli_ctx=cmd.cli_ctx)(command_args=schedule) - - -def get_instance_view(cmd, resource_group_name, vm_name, include_user_data=False): - expand = 'instanceView' - if include_user_data: - expand = expand + ',userData' - return get_vm(cmd, resource_group_name, vm_name, expand) - - -def get_vm(cmd, resource_group_name, vm_name, expand=None): - client = _compute_client_factory(cmd.cli_ctx) - return client.virtual_machines.get(resource_group_name, vm_name, expand=expand) - - -def get_vm_to_update(cmd, resource_group_name, vm_name): - client = _compute_client_factory(cmd.cli_ctx) - vm = client.virtual_machines.get(resource_group_name, vm_name) - # To avoid unnecessary permission check of image - vm.storage_profile.image_reference = None - return vm - - -def get_vm_details(cmd, resource_group_name, vm_name, include_user_data=False): - from azure.mgmt.core.tools import parse_resource_id - - NicShow = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.nic").Show - PublicIPShow = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.public_ip").Show - - result = get_instance_view(cmd, resource_group_name, vm_name, include_user_data) - public_ips = [] - fqdns = [] - private_ips = [] - mac_addresses = [] - # pylint: disable=line-too-long,no-member - for nic_ref in result.network_profile.network_interfaces: - nic_parts = parse_resource_id(nic_ref.id) - nic = NicShow(cli_ctx=cmd.cli_ctx)(command_args={ - "name": nic_parts['name'], - 'resource_group': nic_parts['resource_group'] - }) - if 'macAddress' in nic: - mac_addresses.append(nic['macAddress']) - for ip_configuration in nic['ipConfigurations']: - if 'privateIPAddress' in ip_configuration: - private_ips.append(ip_configuration['privateIPAddress']) - if 'publicIPAddress' in ip_configuration: - res = parse_resource_id(ip_configuration['publicIPAddress']['id']) - public_ip_info = PublicIPShow(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': res['name'], - 'resource_group': res['resource_group'] - }) - if 'ipAddress' in public_ip_info: - public_ips.append(public_ip_info['ipAddress']) - if 'dnsSettings' in public_ip_info: - fqdns.append(public_ip_info['dnsSettings']['fqdn']) - - setattr(result, 'power_state', - ','.join([s.display_status for s in result.instance_view.statuses if s.code.startswith('PowerState/')])) - setattr(result, 'public_ips', ','.join(public_ips)) - setattr(result, 'fqdns', ','.join(fqdns)) - setattr(result, 'private_ips', ','.join(private_ips)) - setattr(result, 'mac_addresses', ','.join(mac_addresses)) - del result.instance_view # we don't need other instance_view info as people won't care - return result - - -def list_skus(cmd, location=None, size=None, zone=None, show_all=None, resource_type=None): - from ._vm_utils import list_sku_info, is_sku_available - result = list_sku_info(cmd.cli_ctx, location) - # pylint: disable=too-many-nested-blocks - if not show_all: - available_skus = [] - for sku_info in result: - if is_sku_available(cmd, sku_info, zone): - available_skus.append(sku_info) - result = available_skus - if resource_type: - result = [x for x in result if x['resourceType'].lower() == resource_type.lower()] - if size: - result = [x for x in result if x['resourceType'] == 'virtualMachines' and size.lower() in x['name'].lower()] - if zone: - result = [x for x in result if x['locationInfo'] and x['locationInfo'][0]['zones']] - return result - - -# pylint: disable=redefined-builtin -def list_vm(cmd, resource_group_name=None, show_details=False, vmss=None): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id, parse_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - ccf = _compute_client_factory(cmd.cli_ctx) - if vmss is not None: - if is_valid_resource_id(vmss): - filter = "'virtualMachineScaleSet/id' eq '{}'".format(vmss) - if resource_group_name is None: - resource_group_name = parse_resource_id(vmss)['resource_group'] - else: - if resource_group_name is None: - raise RequiredArgumentMissingError( - 'usage error: please specify the --resource-group when listing VM instances with VMSS name') - vmss_id = resource_id(subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='virtualMachineScaleSets', name=vmss) - filter = "'virtualMachineScaleSet/id' eq '{}'".format(vmss_id) - vm_list = ccf.virtual_machines.list(resource_group_name=resource_group_name, filter=filter) - else: - vm_list = ccf.virtual_machines.list(resource_group_name=resource_group_name) \ - if resource_group_name else ccf.virtual_machines.list_all() - if show_details: - return [get_vm_details(cmd, _parse_rg_name(v.id)[0], v.name) for v in vm_list] - - return list(vm_list) - - -def list_vm_ip_addresses(cmd, resource_group_name=None, vm_name=None): - # We start by getting NICs as they are the smack in the middle of all data that we - # want to collect for a VM (as long as we don't need any info on the VM than what - # is available in the Id, we don't need to make any calls to the compute RP) - # - # Since there is no guarantee that a NIC is in the same resource group as a given - # Virtual Machine, we can't constrain the lookup to only a single group... - NicList = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.nic").List - PublicIPList = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.public_ip").List - - nics = NicList(cli_ctx=cmd.cli_ctx)(command_args={}) - public_ip_addresses = PublicIPList(cli_ctx=cmd.cli_ctx)(command_args={}) - - ip_address_lookup = {pip['id']: pip for pip in list(public_ip_addresses)} - - result = [] - for nic in [n for n in list(nics) if 'virtualMachine' in n and n['virtualMachine']]: - nic_resource_group, nic_vm_name = _parse_rg_name(nic['virtualMachine']['id']) - - # If provided, make sure that resource group name and vm name match the NIC we are - # looking at before adding it to the result... - same_resource_group_name = (resource_group_name is None or - resource_group_name.lower() == nic_resource_group.lower()) - same_vm_name = (vm_name is None or - vm_name.lower() == nic_vm_name.lower()) - if same_resource_group_name and same_vm_name: - network_info = { - 'privateIpAddresses': [], - 'publicIpAddresses': [] - } - for ip_configuration in nic['ipConfigurations']: - network_info['privateIpAddresses'].append(ip_configuration['privateIPAddress']) - if 'publicIPAddress' in ip_configuration and ip_configuration['publicIPAddress'] and \ - ip_configuration['publicIPAddress']['id'] in ip_address_lookup: - public_ip_address = ip_address_lookup[ip_configuration['publicIPAddress']['id']] - - public_ip_addr_info = { - 'id': public_ip_address['id'], - 'name': public_ip_address['name'], - 'ipAddress': public_ip_address.get('ipAddress', None), - 'ipAllocationMethod': public_ip_address.get('publicIPAllocationMethod', None) - } - - try: - public_ip_addr_info['zone'] = public_ip_address['zones'][0] \ - if 'zones' in public_ip_address else None - except (KeyError, IndexError, TypeError): - pass - - network_info['publicIpAddresses'].append(public_ip_addr_info) - - result.append({ - 'virtualMachine': { - 'resourceGroup': nic_resource_group, - 'name': nic_vm_name, - 'network': network_info - } - }) - - return result - - -def open_vm_port(cmd, resource_group_name, vm_name, port, priority=900, network_security_group_name=None, - apply_to_subnet=False): - from azure.mgmt.core.tools import parse_resource_id - _nic = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.nic") - NicShow, NicUpdate = _nic.Show, _nic.Update - _subnet = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.vnet.subnet") - SubnetShow, SubnetUpdate = _subnet.Show, _subnet.Update - _nsg = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.nsg") - NSGShow, NSGCreate = _nsg.Show, _nsg.Create - NSGRuleCreate = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.nsg.rule").Create - - vm = get_vm(cmd, resource_group_name, vm_name) - location = vm.location - if not vm.network_profile: - raise CLIError("Network profile not found for VM '{}'".format(vm_name)) - - nic_ids = list(vm.network_profile.network_interfaces) - if len(nic_ids) > 1: - raise CLIError('Multiple NICs is not supported for this command. Create rules on the NSG ' - 'directly.') - if not nic_ids: - raise CLIError("No NIC associated with VM '{}'".format(vm_name)) - - # get existing NSG or create a new one - created_nsg = False - nic = NicShow(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': os.path.split(nic_ids[0].id)[1], - 'resource_group': resource_group_name - }) - if not apply_to_subnet: - nsg = nic['networkSecurityGroup'] - else: - subnet_id = parse_resource_id(nic['ipConfigurations'][0]['subnet']['id']) - subnet = SubnetShow(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': subnet_id['child_name_1'], - 'vnet_name': subnet_id['name'], - 'resource_group': resource_group_name - }) - nsg = subnet['networkSecurityGroup'] if 'networkSecurityGroup' in subnet else None - - if not nsg: - nsg = LongRunningOperation(cmd.cli_ctx, 'Creating network security group')( - NSGCreate(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': network_security_group_name, - 'resource_group': resource_group_name, - 'location': location - })) - created_nsg = True - - # update the NSG with the new rule to allow inbound traffic - - rule_name = 'open-port-all' if port == '*' else 'open-port-{}'.format((port.replace(',', '_'))) - - # use portranges if multiple ports are entered - if "," not in port: - port_arg = { - 'destination_port_range': port - } - else: - port_arg = { - 'destination_port_ranges': port.split(',') - } - - nsg_name = nsg['name'] if 'name' in nsg else os.path.split(nsg['id'])[1] - LongRunningOperation(cmd.cli_ctx, 'Adding security rule')( - NSGRuleCreate(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': rule_name, - 'nsg_name': nsg_name, - 'resource_group': resource_group_name, - 'protocol': '*', - 'access': 'allow', - 'direction': 'inbound', - 'source_port_range': '*', - **port_arg, - 'priority': priority, - 'source_address_prefix': '*', - 'destination_address_prefix': '*' - }) - ) - - # update the NIC or subnet if a new NSG was created - if created_nsg and not apply_to_subnet: - nic['networkSecurityGroup'] = nsg - LongRunningOperation(cmd.cli_ctx, 'Updating NIC')( - NicUpdate(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': nic['name'], - 'resource_group': resource_group_name, - 'security_rules': nic - })) - elif created_nsg and apply_to_subnet: - subnet['networkSecurityGroup'] = nsg - LongRunningOperation(cmd.cli_ctx, 'Updating subnet')( - SubnetUpdate(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': subnet_id['child_name_1'], - 'resource_group': resource_group_name, - 'vnet_name': subnet_id['name'], - 'subnet': subnet - }) - ) - - return NSGShow(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': nsg_name, - 'resource_group': resource_group_name - }) - - -def resize_vm(cmd, resource_group_name, vm_name, size, no_wait=False): - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - if vm.hardware_profile.vm_size == size: - logger.warning("VM is already %s", size) - return None - - vm.hardware_profile.vm_size = size # pylint: disable=no-member - return set_vm(cmd, vm, no_wait=no_wait) - - -def restart_vm(cmd, resource_group_name, vm_name, no_wait=False, force=False): - client = _compute_client_factory(cmd.cli_ctx) - if force: - return sdk_no_wait(no_wait, client.virtual_machines.begin_redeploy, resource_group_name, vm_name) - return sdk_no_wait(no_wait, client.virtual_machines.begin_restart, resource_group_name, vm_name) - - -def set_vm(cmd, instance, lro_operation=None, no_wait=False): - instance.resources = None # Issue: https://github.com/Azure/autorest/issues/934 - client = _compute_client_factory(cmd.cli_ctx) - parsed_id = _parse_rg_name(instance.id) - poller = sdk_no_wait(no_wait, client.virtual_machines.begin_create_or_update, - resource_group_name=parsed_id[0], - vm_name=parsed_id[1], - parameters=instance) - if lro_operation: - return lro_operation(poller) - - return LongRunningOperation(cmd.cli_ctx)(poller) - - -def patch_vm(cmd, resource_group_name, vm_name, vm): - client = _compute_client_factory(cmd.cli_ctx) - poller = client.virtual_machines.begin_update(resource_group_name, vm_name, vm) - return LongRunningOperation(cmd.cli_ctx)(poller) - - -def patch_disk_encryption_set(cmd, resource_group_name, disk_encryption_set_name, disk_encryption_set_update): - client = _compute_client_factory(cmd.cli_ctx) - poller = client.disk_encryption_sets.begin_update(resource_group_name, disk_encryption_set_name, - disk_encryption_set_update) - return LongRunningOperation(cmd.cli_ctx)(poller) - - -def show_vm(cmd, resource_group_name, vm_name, show_details=False, include_user_data=False): - if show_details: - return get_vm_details(cmd, resource_group_name, vm_name, include_user_data) - - expand = None - if include_user_data: - expand = "userData" - return get_vm(cmd, resource_group_name, vm_name, expand) - - -def update_vm(cmd, resource_group_name, vm_name, os_disk=None, disk_caching=None, - write_accelerator=None, license_type=None, no_wait=False, ultra_ssd_enabled=None, - priority=None, max_price=None, proximity_placement_group=None, workspace=None, enable_secure_boot=None, - enable_vtpm=None, user_data=None, capacity_reservation_group=None, - dedicated_host=None, dedicated_host_group=None, size=None, ephemeral_os_disk_placement=None, - enable_hibernation=None, v_cpus_available=None, v_cpus_per_core=None, disk_controller_type=None, - security_type=None, enable_proxy_agent=None, proxy_agent_mode=None, **kwargs): - from azure.mgmt.core.tools import parse_resource_id, resource_id, is_valid_resource_id - from ._vm_utils import update_write_accelerator_settings, update_disk_caching - SecurityProfile, UefiSettings = cmd.get_models('SecurityProfile', 'UefiSettings') - vm = kwargs['parameters'] - - disk_name = None - if os_disk is not None: - if is_valid_resource_id(os_disk): - disk_id = os_disk - os_disk_id_parsed = parse_resource_id(os_disk) - disk_name = os_disk_id_parsed['name'] - else: - vm_id_parsed = parse_resource_id(vm.id) - disk_id = resource_id(subscription=vm_id_parsed['subscription'], - resource_group=vm_id_parsed['resource_group'], - namespace='Microsoft.Compute', type='disks', name=os_disk) - disk_name = os_disk - vm.storage_profile.os_disk.managed_disk.id = disk_id - vm.storage_profile.os_disk.name = disk_name - - if security_type == "TrustedLaunch": - from azure.cli.core.azclierror import InvalidArgumentValueError - if vm.security_profile is not None and vm.security_profile.security_type == "ConfidentialVM": - raise InvalidArgumentValueError("{} is already configured with ConfidentialVM. Security Configuration " - "cannot be updated from ConfidentialVM to TrustedLaunch.".format(vm.name)) - - if disk_name is None and vm.storage_profile.os_disk.managed_disk is not None: - os_disk_id_parsed = parse_resource_id(vm.storage_profile.os_disk.managed_disk.id) - disk_name = os_disk_id_parsed['name'] - - if disk_name is not None: - # Set --enable-secure-boot True and --enable-vtpm True if not specified by end user. - enable_secure_boot = enable_secure_boot if enable_secure_boot is not None else True - enable_vtpm = enable_vtpm if enable_vtpm is not None else True - - if vm.security_profile is None: - vm.security_profile = SecurityProfile() - vm.security_profile.security_type = security_type - - if write_accelerator is not None: - update_write_accelerator_settings(vm.storage_profile, write_accelerator) - - if disk_caching is not None: - update_disk_caching(vm.storage_profile, disk_caching) - - if license_type is not None: - vm.license_type = license_type - - if user_data is not None: - from azure.cli.core.util import b64encode - vm.user_data = b64encode(user_data) - - if capacity_reservation_group is not None: - CapacityReservationProfile = cmd.get_models('CapacityReservationProfile') - SubResource = cmd.get_models('SubResource') - if capacity_reservation_group == 'None': - capacity_reservation_group = None - sub_resource = SubResource(id=capacity_reservation_group) - capacity_reservation = CapacityReservationProfile(capacity_reservation_group=sub_resource) - vm.capacity_reservation = capacity_reservation - - if dedicated_host is not None: - if vm.host is None: - DedicatedHost = cmd.get_models('SubResource') - vm.host = DedicatedHost(additional_properties={}, id=dedicated_host) - else: - vm.host.id = dedicated_host - if vm.host_group is not None: - vm.host_group = None - - if dedicated_host_group is not None: - if vm.host_group is None: - DedicatedHostGroup = cmd.get_models('SubResource') - vm.host_group = DedicatedHostGroup(additional_properties={}, id=dedicated_host_group) - else: - vm.host_group.id = dedicated_host_group - if vm.host is not None: - vm.host = None - - if ultra_ssd_enabled is not None: - if vm.additional_capabilities is None: - AdditionalCapabilities = cmd.get_models('AdditionalCapabilities') - vm.additional_capabilities = AdditionalCapabilities(ultra_ssd_enabled=ultra_ssd_enabled) - else: - vm.additional_capabilities.ultra_ssd_enabled = ultra_ssd_enabled - - if enable_hibernation is not None: - if vm.additional_capabilities is None: - AdditionalCapabilities = cmd.get_models('AdditionalCapabilities') - vm.additional_capabilities = AdditionalCapabilities(hibernation_enabled=enable_hibernation) - else: - vm.additional_capabilities.hibernation_enabled = enable_hibernation - - if priority is not None: - vm.priority = priority - - if max_price is not None: - if vm.billing_profile is None: - BillingProfile = cmd.get_models('BillingProfile') - vm.billing_profile = BillingProfile(max_price=max_price) - else: - vm.billing_profile.max_price = max_price - - if proximity_placement_group is not None: - vm.proximity_placement_group = {'id': proximity_placement_group} - - if enable_secure_boot is not None or enable_vtpm is not None: - if vm.security_profile is None: - vm.security_profile = SecurityProfile() - - vm.security_profile.uefi_settings = UefiSettings(secure_boot_enabled=enable_secure_boot, - v_tpm_enabled=enable_vtpm) - - if enable_proxy_agent is not None or proxy_agent_mode is not None: - ProxyAgentSettings = cmd.get_models('ProxyAgentSettings') - if vm.security_profile is None: - vm.security_profile = SecurityProfile() - vm.security_profile.proxy_agent_settings = ProxyAgentSettings(enabled=enable_proxy_agent, - mode=proxy_agent_mode) - elif vm.security_profile.proxy_agent_settings is None: - vm.security_profile.proxy_agent_settings = ProxyAgentSettings(enabled=enable_proxy_agent, - mode=proxy_agent_mode) - else: - vm.security_profile.proxy_agent_settings.enabled = enable_proxy_agent - vm.security_profile.proxy_agent_settings.mode = proxy_agent_mode - - if workspace is not None: - workspace_id = _prepare_workspace(cmd, resource_group_name, workspace) - workspace_name = parse_resource_id(workspace_id)['name'] - _set_log_analytics_workspace_extension(cmd=cmd, - resource_group_name=resource_group_name, - vm=vm, - vm_name=vm_name, - workspace_name=workspace_name) - os_type = vm.storage_profile.os_disk.os_type if vm.storage_profile.os_disk.os_type else None - _set_data_source_for_workspace(cmd, os_type, resource_group_name, workspace_name) - - aux_subscriptions = None - if vm and vm.storage_profile and vm.storage_profile.image_reference and 'id' in vm.storage_profile.image_reference: - aux_subscriptions = _parse_aux_subscriptions(vm.storage_profile.image_reference['id']) - - if size is not None: - if vm.hardware_profile.vm_size == size: - logger.warning("VM size is already %s", size) - else: - vm.hardware_profile.vm_size = size - - if v_cpus_available is not None: - vm.hardware_profile.vm_size_properties.v_cpus_available = v_cpus_available - - if v_cpus_per_core is not None: - vm.hardware_profile.vm_size_properties.v_cpus_per_core = v_cpus_per_core - - if ephemeral_os_disk_placement is not None: - if vm.storage_profile.os_disk.diff_disk_settings is not None: - vm.storage_profile.os_disk.diff_disk_settings.placement = ephemeral_os_disk_placement - else: - raise ValidationError("Please update the argument '--ephemeral-os-disk-placement' when " - "creating VM with the option '--ephemeral-os-disk true'") - if disk_controller_type is not None: - vm.storage_profile.disk_controller_type = disk_controller_type - - client = _compute_client_factory(cmd.cli_ctx, aux_subscriptions=aux_subscriptions) - return sdk_no_wait(no_wait, client.virtual_machines.begin_create_or_update, resource_group_name, vm_name, **kwargs) - - -# endregion - - -# region VirtualMachines AvailabilitySets -def create_av_set(cmd, availability_set_name, resource_group_name, platform_fault_domain_count=2, - platform_update_domain_count=None, location=None, proximity_placement_group=None, unmanaged=False, - no_wait=False, tags=None, validate=False): - from azure.cli.core.util import random_string - from azure.cli.core.commands.arm import ArmTemplateBuilder - from azure.cli.command_modules.vm.azure_stack._template_builder import build_av_set_resource - - tags = tags or {} - - # Build up the ARM template - master_template = ArmTemplateBuilder() - - av_set_resource = build_av_set_resource(cmd, availability_set_name, location, tags, - platform_update_domain_count, - platform_fault_domain_count, unmanaged, - proximity_placement_group=proximity_placement_group) - master_template.add_resource(av_set_resource) - - template = master_template.build() - - # deploy ARM template - deployment_name = 'av_set_deploy_' + random_string(32) - client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES).deployments - DeploymentProperties = cmd.get_models('DeploymentProperties', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) - properties = DeploymentProperties(template=template, parameters={}, mode='incremental') - Deployment = cmd.get_models('Deployment', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) - deployment = Deployment(properties=properties) - - if validate: - if cmd.supported_api_version(min_api='2019-10-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES): - validation_poller = client.begin_validate(resource_group_name, deployment_name, deployment) - return LongRunningOperation(cmd.cli_ctx)(validation_poller) - - return client.validate(resource_group_name, deployment_name, deployment) - - if no_wait: - return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, deployment_name, deployment) - LongRunningOperation(cmd.cli_ctx)(sdk_no_wait(no_wait, client.begin_create_or_update, - resource_group_name, deployment_name, deployment)) - - AvailSet = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, 'vm.availability_set') - return AvailSet.Show(cli_ctx=cmd.cli_ctx)(command_args={'resource_group': resource_group_name, - 'availability_set_name': availability_set_name}) - - -# endregion - - -# region VirtualMachines BootDiagnostics -def disable_boot_diagnostics(cmd, resource_group_name, vm_name): - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - diag_profile = vm.diagnostics_profile - if not (diag_profile and diag_profile.boot_diagnostics and diag_profile.boot_diagnostics.enabled): - return - - diag_profile.boot_diagnostics.enabled = False - diag_profile.boot_diagnostics.storage_uri = None - set_vm(cmd, vm, ExtensionUpdateLongRunningOperation(cmd.cli_ctx, 'disabling boot diagnostics', 'done')) - - -def enable_boot_diagnostics(cmd, resource_group_name, vm_name, storage=None): - from azure.cli.command_modules.vm.azure_stack._vm_utils import get_storage_blob_uri - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - storage_uri = None - if storage: - storage_uri = get_storage_blob_uri(cmd.cli_ctx, storage) - - DiagnosticsProfile, BootDiagnostics = cmd.get_models('DiagnosticsProfile', 'BootDiagnostics') - - boot_diag = BootDiagnostics(enabled=True, storage_uri=storage_uri) - if vm.diagnostics_profile is None: - vm.diagnostics_profile = DiagnosticsProfile(boot_diagnostics=boot_diag) - else: - vm.diagnostics_profile.boot_diagnostics = boot_diag - - set_vm(cmd, vm, ExtensionUpdateLongRunningOperation(cmd.cli_ctx, 'enabling boot diagnostics', 'done')) - - -class BootLogStreamWriter: # pylint: disable=too-few-public-methods - - def __init__(self, out): - self.out = out - - def write(self, str_or_bytes): - content = str_or_bytes - if isinstance(str_or_bytes, bytes): - try: - content = str_or_bytes.decode('utf8') - except UnicodeDecodeError: - logger.warning("A few characters have been ignored because they were not valid unicode.") - content = str_or_bytes.decode('ascii', 'ignore') - try: - self.out.write(content) - except UnicodeEncodeError: - # e.g. 'charmap' codec can't encode characters in position 258829-258830: character maps to - import unicodedata - ascii_content = unicodedata.normalize('NFKD', content).encode('ascii', 'ignore') - self.out.write(ascii_content.decode()) - logger.warning("A few unicode characters have been ignored because the shell is not able to display. " - "To see the full log, use a shell with unicode capacity") - - -def get_boot_log(cmd, resource_group_name, vm_name): - import re - import sys - from azure.cli.core.profiles import get_sdk - from azure.core.exceptions import HttpResponseError - BlockBlobService = get_sdk(cmd.cli_ctx, ResourceType.DATA_STORAGE, 'blob.blockblobservice#BlockBlobService') - - client = _compute_client_factory(cmd.cli_ctx) - - virtual_machine = client.virtual_machines.get(resource_group_name, vm_name, expand='instanceView') - # pylint: disable=no-member - - blob_uri = None - if virtual_machine.instance_view and virtual_machine.instance_view.boot_diagnostics: - blob_uri = virtual_machine.instance_view.boot_diagnostics.serial_console_log_blob_uri - - # Managed storage - if blob_uri is None: - try: - boot_diagnostics_data = client.virtual_machines.retrieve_boot_diagnostics_data(resource_group_name, vm_name) - blob_uri = boot_diagnostics_data.serial_console_log_blob_uri - except HttpResponseError: - pass - if blob_uri is None: - raise CLIError('Please enable boot diagnostics.') - return requests.get(blob_uri).content - - # Find storage account for diagnostics - storage_mgmt_client = _get_storage_management_client(cmd.cli_ctx) - if not blob_uri: - raise CLIError('No console log available') - try: - storage_accounts = storage_mgmt_client.storage_accounts.list() - matching_storage_account = (a for a in list(storage_accounts) - if a.primary_endpoints.blob and blob_uri.startswith(a.primary_endpoints.blob)) - storage_account = next(matching_storage_account) - except StopIteration: - raise CLIError('Failed to find storage account for console log file') - - regex = r'/subscriptions/[^/]+/resourceGroups/(?P[^/]+)/.+' - match = re.search(regex, storage_account.id, re.I) - rg = match.group('rg') - # Get account key - keys = storage_mgmt_client.storage_accounts.list_keys(rg, storage_account.name) - - # Extract container and blob name from url... - container, blob = urlparse(blob_uri).path.split('/')[-2:] - - storage_client = get_data_service_client( - cmd.cli_ctx, - BlockBlobService, - storage_account.name, - keys.keys[0].value, - endpoint_suffix=cmd.cli_ctx.cloud.suffixes.storage_endpoint) # pylint: disable=no-member - - # our streamwriter not seekable, so no parallel. - storage_client.get_blob_to_stream(container, blob, BootLogStreamWriter(sys.stdout), max_connections=1) - - -def get_boot_log_uris(cmd, resource_group_name, vm_name, expire=None): - client = _compute_client_factory(cmd.cli_ctx) - return client.virtual_machines.retrieve_boot_diagnostics_data( - resource_group_name, vm_name, sas_uri_expiration_time_in_minutes=expire) - - -# endregion - - -# region VirtualMachines Diagnostics -def set_diagnostics_extension( - cmd, resource_group_name, vm_name, settings, protected_settings=None, version=None, - no_auto_upgrade=False): - client = _compute_client_factory(cmd.cli_ctx) - vm = client.virtual_machines.get(resource_group_name, vm_name, expand='instanceView') - # pylint: disable=no-member - is_linux_os = _is_linux_os(vm) - vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT - if is_linux_os: # check incompatible version - exts = vm.instance_view.extensions or [] - major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0] - if next((e for e in exts if e.name == vm_extension_name and - not e.type_handler_version.startswith(major_ver + '.')), None): - logger.warning('There is an incompatible version of diagnostics extension installed. ' - 'We will update it with a new version') - poller = client.virtual_machine_extensions.begin_delete(resource_group_name, vm_name, vm_extension_name) - LongRunningOperation(cmd.cli_ctx)(poller) - - return set_extension(cmd, resource_group_name, vm_name, vm_extension_name, - extension_mappings[vm_extension_name]['publisher'], - version or extension_mappings[vm_extension_name]['version'], - settings, - protected_settings, - no_auto_upgrade) - - -def show_default_diagnostics_configuration(is_windows_os=False): - public_settings = get_default_diag_config(is_windows_os) - # pylint: disable=line-too-long - protected_settings_info = json.dumps({ - 'storageAccountName': "__STORAGE_ACCOUNT_NAME__", - # LAD and WAD are not consistent on sas token format. Call it out here - "storageAccountSasToken": "__SAS_TOKEN_{}__".format( - "WITH_LEADING_QUESTION_MARK" if is_windows_os else "WITHOUT_LEADING_QUESTION_MARK") - }, indent=2) - logger.warning( - 'Protected settings with storage account info is required to work with the default configurations, e.g. \n%s', - protected_settings_info) - return public_settings - - -# endregion - - -# region VirtualMachines Disks (Managed) -def attach_managed_data_disk(cmd, resource_group_name, vm_name, disk=None, ids=None, disks=None, new=False, sku=None, - size_gb=None, lun=None, caching=None, enable_write_accelerator=False, disk_ids=None): - # attach multiple managed disks using disk attach API - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - if not new and not sku and not size_gb and disk_ids is not None: - if lun: - disk_lun = lun - else: - disk_lun = _get_disk_lun(vm.storage_profile.data_disks) - - data_disks = [] - for disk_item in disk_ids: - disk = { - 'diskId': disk_item, - 'caching': caching, - 'lun': disk_lun, - 'writeAcceleratorEnabled': enable_write_accelerator - } - data_disks.append(disk) - disk_lun += 1 - result = AttachDetachDataDisk(cli_ctx=cmd.cli_ctx)(command_args={ - 'vm_name': vm_name, - 'resource_group': resource_group_name, - 'data_disks_to_attach': data_disks - }) - return result - else: - # attach multiple managed disks using vm PUT API - from azure.mgmt.core.tools import parse_resource_id - DataDisk, ManagedDiskParameters, DiskCreateOption = cmd.get_models( - 'DataDisk', 'ManagedDiskParameters', 'DiskCreateOptionTypes') - if size_gb is None: - size_gb = 1023 - - if disk_ids is not None: - disks = disk_ids - - for disk_item in disks: - if lun: - disk_lun = lun - else: - disk_lun = _get_disk_lun(vm.storage_profile.data_disks) - - if new: - data_disk = DataDisk(lun=disk_lun, create_option=DiskCreateOption.empty, - name=parse_resource_id(disk_item)['name'], - disk_size_gb=size_gb, caching=caching, - managed_disk=ManagedDiskParameters(storage_account_type=sku)) - else: - params = ManagedDiskParameters(id=disk_item, storage_account_type=sku) - data_disk = DataDisk(lun=disk_lun, create_option=DiskCreateOption.attach, managed_disk=params, - caching=caching) - - if enable_write_accelerator: - data_disk.write_accelerator_enabled = enable_write_accelerator - - vm.storage_profile.data_disks.append(data_disk) - - set_vm(cmd, vm) - - -def detach_unmanaged_data_disk(cmd, resource_group_name, vm_name, disk_name): - # here we handle unmanaged disk - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - # pylint: disable=no-member - leftovers = [d for d in vm.storage_profile.data_disks if d.name.lower() != disk_name.lower()] - if len(vm.storage_profile.data_disks) == len(leftovers): - raise CLIError("No disk with the name '{}' was found".format(disk_name)) - vm.storage_profile.data_disks = leftovers - set_vm(cmd, vm) - - -# endregion - - -def detach_managed_data_disk(cmd, resource_group_name, vm_name, disk_name=None, force_detach=None, disk_ids=None): - if disk_ids is not None: - data_disks = [] - for disk_item in disk_ids: - disk = {'diskId': disk_item, 'detachOption': 'ForceDetach' if force_detach else None} - data_disks.append(disk) - result = AttachDetachDataDisk(cli_ctx=cmd.cli_ctx)(command_args={ - 'vm_name': vm_name, - 'resource_group': resource_group_name, - 'data_disks_to_detach': data_disks - }) - return result - else: - # here we handle managed disk - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - if not force_detach: - # pylint: disable=no-member - leftovers = [d for d in vm.storage_profile.data_disks if d.name.lower() != disk_name.lower()] - if len(vm.storage_profile.data_disks) == len(leftovers): - raise ResourceNotFoundError("No disk with the name '{}' was found".format(disk_name)) - else: - DiskDetachOptionTypes = cmd.get_models('DiskDetachOptionTypes', resource_type=ResourceType.MGMT_COMPUTE, - operation_group='virtual_machines') - leftovers = vm.storage_profile.data_disks - is_contains = False - for d in leftovers: - if d.name.lower() == disk_name.lower(): - d.to_be_detached = True - d.detach_option = DiskDetachOptionTypes.FORCE_DETACH - is_contains = True - break - if not is_contains: - raise ResourceNotFoundError("No disk with the name '{}' was found".format(disk_name)) - vm.storage_profile.data_disks = leftovers - set_vm(cmd, vm) - - -# endregion - - -# region VirtualMachines Extensions -def list_extensions(cmd, resource_group_name, vm_name): - vm = get_vm(cmd, resource_group_name, vm_name) - extension_type = 'Microsoft.Compute/virtualMachines/extensions' - result = [r for r in (vm.resources or []) if r.type == extension_type] - return result - - -def show_extensions(cmd, resource_group_name, vm_name, vm_extension_name, instance_view=False, expand=None): - if instance_view: - expand = 'instanceView' - client = _compute_client_factory(cmd.cli_ctx).virtual_machine_extensions - return client.get(resource_group_name=resource_group_name, - vm_name=vm_name, - vm_extension_name=vm_extension_name, - expand=expand) - - -def set_extension(cmd, resource_group_name, vm_name, vm_extension_name, publisher, version=None, settings=None, - protected_settings=None, no_auto_upgrade=False, force_update=False, no_wait=False, - extension_instance_name=None, enable_auto_upgrade=None): - vm = get_vm(cmd, resource_group_name, vm_name, 'instanceView') - client = _compute_client_factory(cmd.cli_ctx) - - if not extension_instance_name: - extension_instance_name = vm_extension_name - - VirtualMachineExtension = cmd.get_models('VirtualMachineExtension', - resource_type=ResourceType.MGMT_COMPUTE, - operation_group='virtual_machines') - instance_name = _get_extension_instance_name(vm.instance_view, publisher, vm_extension_name, - suggested_name=extension_instance_name) - if instance_name != extension_instance_name: - msg = "A %s extension with name %s already exists. Updating it with your settings..." - logger.warning(msg, vm_extension_name, instance_name) - if vm_extension_name == 'AHBForRHEL': - logger.warning('Please ensure that you are provisioning AHBForRHEL extension ' - 'on a Red Hat based operating system.') - if vm_extension_name == 'AHBForSLES': - logger.warning('Please ensure that you are provisioning AHBForSLES extension on a SLES based operating system.') - - auto_upgrade_extensions = ['GuestAttestation', 'CodeIntegrityAgent'] - if vm_extension_name in auto_upgrade_extensions and enable_auto_upgrade is None: - enable_auto_upgrade = True - - version = _normalize_extension_version(cmd.cli_ctx, publisher, vm_extension_name, version, vm.location) - ext = VirtualMachineExtension(location=vm.location, - publisher=publisher, - type_properties_type=vm_extension_name, - protected_settings=protected_settings, - type_handler_version=version, - settings=settings, - auto_upgrade_minor_version=(not no_auto_upgrade), - enable_automatic_upgrade=enable_auto_upgrade) - if force_update: - ext.force_update_tag = str(_gen_guid()) - return sdk_no_wait(no_wait, client.virtual_machine_extensions.begin_create_or_update, - resource_group_name, vm_name, instance_name, ext) - - -# endregion - - -# region VirtualMachines Extension Images -def list_vm_extension_images( - cmd, image_location=None, publisher_name=None, name=None, version=None, latest=False): - return load_extension_images_thru_services( - cmd.cli_ctx, publisher_name, name, version, image_location, latest) - - -# endregion - - -# region VirtualMachines Identity -def _remove_identities(cmd, resource_group_name, name, identities, getter, setter): - from ._vm_utils import MSI_LOCAL_ID - ResourceIdentityType = cmd.get_models('ResourceIdentityType', operation_group='virtual_machines') - remove_system_assigned_identity = False - if MSI_LOCAL_ID in identities: - remove_system_assigned_identity = True - identities.remove(MSI_LOCAL_ID) - resource = getter(cmd, resource_group_name, name) - if resource.identity is None: - return None - emsis_to_remove = [] - if identities: - existing_emsis = {x.lower() for x in list((resource.identity.user_assigned_identities or {}).keys())} - emsis_to_remove = {x.lower() for x in identities} - non_existing = emsis_to_remove.difference(existing_emsis) - if non_existing: - raise CLIError("'{}' are not associated with '{}'".format(','.join(non_existing), name)) - if not list(existing_emsis - emsis_to_remove): # if all emsis are gone, we need to update the type - if resource.identity.type == ResourceIdentityType.user_assigned: - resource.identity.type = ResourceIdentityType.none - elif resource.identity.type == ResourceIdentityType.system_assigned_user_assigned: - resource.identity.type = ResourceIdentityType.system_assigned - - resource.identity.user_assigned_identities = None - if remove_system_assigned_identity: - resource.identity.type = (ResourceIdentityType.none - if resource.identity.type == ResourceIdentityType.system_assigned - else ResourceIdentityType.user_assigned) - - if emsis_to_remove: - if resource.identity.type not in [ResourceIdentityType.none, ResourceIdentityType.system_assigned]: - resource.identity.user_assigned_identities = {} - for identity in emsis_to_remove: - resource.identity.user_assigned_identities[identity] = None - - result = LongRunningOperation(cmd.cli_ctx)(setter(resource_group_name, name, resource)) - return result.identity - - -def remove_vm_identity(cmd, resource_group_name, vm_name, identities=None): - def setter(resource_group_name, vm_name, vm): - client = _compute_client_factory(cmd.cli_ctx) - VirtualMachineUpdate = cmd.get_models('VirtualMachineUpdate', operation_group='virtual_machines') - vm_update = VirtualMachineUpdate(identity=vm.identity) - return client.virtual_machines.begin_update(resource_group_name, vm_name, vm_update) - - if identities is None: - from ._vm_utils import MSI_LOCAL_ID - identities = [MSI_LOCAL_ID] - - return _remove_identities(cmd, resource_group_name, vm_name, identities, get_vm, setter) - - -# region VirtualMachines Identity -def _remove_disk_encryption_set_identities(cmd, resource_group_name, name, - mi_system_assigned, mi_user_assigned, getter, setter): - IdentityType = cmd.get_models('DiskEncryptionSetIdentityType', operation_group='disk_encryption_sets') - remove_system_assigned_identity = mi_system_assigned is not None - - resource = getter(cmd, resource_group_name, name) - if resource is None or resource.identity is None: - return None - - user_identities_to_remove = [] - if mi_user_assigned is not None: - existing_user_identities = {x.lower() for x in list((resource.identity.user_assigned_identities or {}).keys())} - # all user assigned identities will be removed if the length of mi_user_assigned is 0, - # otherwise the specified identity - user_identities_to_remove = {x.lower() for x in mi_user_assigned} \ - if len(mi_user_assigned) > 0 else existing_user_identities - non_existing = user_identities_to_remove.difference(existing_user_identities) - if non_existing: - from azure.cli.core.azclierror import InvalidArgumentValueError - raise InvalidArgumentValueError("'{}' are not associated with '{}', please provide existing user managed " - "identities".format(','.join(non_existing), name)) - if not list(existing_user_identities - user_identities_to_remove): - if resource.identity.type == IdentityType.USER_ASSIGNED: - resource.identity.type = IdentityType.NONE - elif resource.identity.type == IdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED: - resource.identity.type = IdentityType.SYSTEM_ASSIGNED - - resource.identity.user_assigned_identities = None - if remove_system_assigned_identity: - resource.identity.type = (IdentityType.NONE - if resource.identity.type == IdentityType.SYSTEM_ASSIGNED - else IdentityType.USER_ASSIGNED) - - if user_identities_to_remove: - if resource.identity.type not in [IdentityType.NONE, IdentityType.SYSTEM_ASSIGNED]: - resource.identity.user_assigned_identities = {} - for identity in user_identities_to_remove: - resource.identity.user_assigned_identities[identity] = None - - result = LongRunningOperation(cmd.cli_ctx)(setter(resource_group_name, name, resource)) - return result.identity - - -# endregion - - -# region VirtualMachines Images -def list_vm_images(cmd, image_location=None, publisher_name=None, offer=None, sku=None, all=False, - # pylint: disable=redefined-builtin - edge_zone=None, architecture=None): - load_thru_services = all or edge_zone is not None - - if load_thru_services: - if not publisher_name and not offer and not sku and not edge_zone: - logger.warning("You are retrieving all the images from server which could take more than a minute. " - "To shorten the wait, provide '--publisher', '--offer' , '--sku' or '--edge-zone'." - " Partial name search is supported.") - all_images = load_images_thru_services(cmd.cli_ctx, publisher_name, offer, sku, image_location, edge_zone, - architecture) - else: - all_images = load_images_from_aliases_doc(cmd.cli_ctx, publisher_name, offer, sku, architecture) - logger.warning('You are viewing an offline list of images, use --all to retrieve an up-to-date list') - - if edge_zone is not None: - for i in all_images: - i['urn'] = ':'.join([i['publisher'], i['offer'], i['sku'], i['edge_zone'], i['version']]) - else: - for i in all_images: - i['urn'] = ':'.join([i['publisher'], i['offer'], i['sku'], i['version']]) - return all_images - - -def show_vm_image(cmd, urn=None, publisher=None, offer=None, sku=None, version=None, location=None, edge_zone=None): - from azure.cli.core.commands.parameters import get_one_of_subscription_locations - from azure.cli.core.azclierror import (MutuallyExclusiveArgumentError, - InvalidArgumentValueError) - - location = location or get_one_of_subscription_locations(cmd.cli_ctx) - error_msg = 'Please specify all of (--publisher, --offer, --sku, --version), or --urn' - if urn: - if any([publisher, offer, sku, edge_zone, version]): - recommendation = 'Try to use --urn publisher:offer:sku:version or' \ - ' --urn publisher:offer:sku:edge_zone:version' - raise MutuallyExclusiveArgumentError(error_msg, recommendation) - items = urn.split(":") - if len(items) != 4 and len(items) != 5: - raise InvalidArgumentValueError( - '--urn should be in the format of publisher:offer:sku:version or publisher:offer:sku:edge_zone:version') - if len(items) == 5: - publisher, offer, sku, edge_zone, version = urn.split(":") - elif len(items) == 4: - publisher, offer, sku, version = urn.split(":") - if version.lower() == 'latest': - version = _get_latest_image_version(cmd.cli_ctx, location, publisher, offer, sku) - elif not publisher or not offer or not sku or not version: - raise RequiredArgumentMissingError(error_msg) - - _VMImage = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "vm.image") - return _VMImage.Show(cli_ctx=cmd.cli_ctx)(command_args={ - 'location': location, - 'publisher': publisher, - 'offer': offer, - 'sku': sku, - 'version': version, - }) - - -def accept_market_ordering_terms(cmd, urn=None, publisher=None, offer=None, plan=None): - from azure.mgmt.marketplaceordering import MarketplaceOrderingAgreements - from azure.mgmt.marketplaceordering.models import OfferType - from azure.cli.core.azclierror import (MutuallyExclusiveArgumentError, - InvalidArgumentValueError) - - error_msg = 'Please specify all of (--plan, --offer, --publish), or --urn' - if urn: - if any([publisher, offer, plan]): - recommendation = 'Try to use --urn publisher:offer:sku:version only' - raise MutuallyExclusiveArgumentError(error_msg, recommendation) - items = urn.split(':') - if len(items) != 4: - raise InvalidArgumentValueError('--urn should be in the format of publisher:offer:sku:version') - publisher, offer, _, _ = items - image = show_vm_image(cmd, urn) - if not image.plan: - logger.warning("Image '%s' has no terms to accept.", urn) - return - plan = image.plan.name - else: - if not publisher or not offer or not plan: - raise RequiredArgumentMissingError(error_msg) - - market_place_client = get_mgmt_service_client(cmd.cli_ctx, MarketplaceOrderingAgreements) - - term = market_place_client.marketplace_agreements.get(offer_type=OfferType.VIRTUALMACHINE, - publisher_id=publisher, - offer_id=offer, - plan_id=plan) - term.accepted = True - return market_place_client.marketplace_agreements.create(offer_type=OfferType.VIRTUALMACHINE, - publisher_id=publisher, - offer_id=offer, - plan_id=plan, - parameters=term) - - -# endregion - - -def _terms_prepare(cmd, urn, publisher, offer, plan): - if urn: - if any([publisher, offer, plan]): - raise CLIError('usage error: If using --urn, do not use any of --plan, --offer, --publisher.') - terms = urn.split(':') - if len(terms) != 4: - raise CLIError('usage error: urn should be in the format of publisher:offer:sku:version.') - publisher, offer = terms[0], terms[1] - image = show_vm_image(cmd, urn) - if not image.plan: - raise CLIError("Image '%s' has no terms to accept." % urn) - plan = image.plan.name - else: - if not all([publisher, offer, plan]): - raise CLIError( - 'usage error: If not using --urn, all of --plan, --offer and --publisher should be provided.') - return publisher, offer, plan - - -def _accept_cancel_terms(cmd, urn, publisher, offer, plan, accept): - from azure.mgmt.marketplaceordering.models import OfferType - publisher, offer, plan = _terms_prepare(cmd, urn, publisher, offer, plan) - op = cf_vm_image_term(cmd.cli_ctx, '') - terms = op.get(offer_type=OfferType.VIRTUALMACHINE, - publisher_id=publisher, - offer_id=offer, - plan_id=plan) - terms.accepted = accept - return op.create(offer_type=OfferType.VIRTUALMACHINE, - publisher_id=publisher, - offer_id=offer, - plan_id=plan, - parameters=terms) - - -def accept_terms(cmd, urn=None, publisher=None, offer=None, plan=None): - """ - Accept Azure Marketplace image terms so that the image can be used to create VMs. - :param cmd:cmd - :param urn:URN, in the format of 'publisher:offer:sku:version'. If specified, other argument values can be omitted - :param publisher:Image publisher - :param offer:Image offer - :param plan:Image billing plan - :return: - """ - return _accept_cancel_terms(cmd, urn, publisher, offer, plan, True) - - -def cancel_terms(cmd, urn=None, publisher=None, offer=None, plan=None): - """ - Cancel Azure Marketplace image terms. - :param cmd:cmd - :param urn:URN, in the format of 'publisher:offer:sku:version'. If specified, other argument values can be omitted - :param publisher:Image publisher - :param offer:Image offer - :param plan:Image billing plan - :return: - """ - return _accept_cancel_terms(cmd, urn, publisher, offer, plan, False) - - -def get_terms(cmd, urn=None, publisher=None, offer=None, plan=None): - """ - Get the details of Azure Marketplace image terms. - :param cmd:cmd - :param urn:URN, in the format of 'publisher:offer:sku:version'. If specified, other argument values can be omitted - :param publisher:Image publisher - :param offer:Image offer - :param plan:Image billing plan - :return: - """ - from azure.mgmt.marketplaceordering.models import OfferType - publisher, offer, plan = _terms_prepare(cmd, urn, publisher, offer, plan) - op = cf_vm_image_term(cmd.cli_ctx, '') - terms = op.get(offer_type=OfferType.VIRTUALMACHINE, - publisher_id=publisher, - offer_id=offer, - plan_id=plan) - return terms - - -# region VirtualMachines NetworkInterfaces (NICs) -def show_vm_nic(cmd, resource_group_name, vm_name, nic): - from azure.mgmt.core.tools import parse_resource_id - - NicShow = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.nic").Show - - vm = get_vm(cmd, resource_group_name, vm_name) - found = next( - (n for n in vm.network_profile.network_interfaces if nic.lower() == n.id.lower()), None - # pylint: disable=no-member - ) - if found: - nic_name = parse_resource_id(found.id)['name'] - return NicShow(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': nic_name, - 'resource_group': resource_group_name - }) - raise CLIError("NIC '{}' not found on VM '{}'".format(nic, vm_name)) - - -def list_vm_nics(cmd, resource_group_name, vm_name): - vm = get_vm(cmd, resource_group_name, vm_name) - return vm.network_profile.network_interfaces # pylint: disable=no-member - - -def add_vm_nic(cmd, resource_group_name, vm_name, nics, primary_nic=None): - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - new_nics = _build_nic_list(cmd, nics) - existing_nics = _get_existing_nics(vm) - return _update_vm_nics(cmd, vm, existing_nics + new_nics, primary_nic) - - -def remove_vm_nic(cmd, resource_group_name, vm_name, nics, primary_nic=None): - def to_delete(nic_id): - return [n for n in nics_to_delete if n.id.lower() == nic_id.lower()] - - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - nics_to_delete = _build_nic_list(cmd, nics) - existing_nics = _get_existing_nics(vm) - survived = [x for x in existing_nics if not to_delete(x.id)] - return _update_vm_nics(cmd, vm, survived, primary_nic) - - -def set_vm_nic(cmd, resource_group_name, vm_name, nics, primary_nic=None): - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - nics = _build_nic_list(cmd, nics) - return _update_vm_nics(cmd, vm, nics, primary_nic) - - -def _build_nic_list(cmd, nic_ids): - NicShow = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.nic").Show - - NetworkInterfaceReference = cmd.get_models('NetworkInterfaceReference') - nic_list = [] - if nic_ids: - # pylint: disable=no-member - for nic_id in nic_ids: - rg, name = _parse_rg_name(nic_id) - nic = NicShow(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': name, - 'resource_group': rg - }) - nic_list.append((NetworkInterfaceReference(id=nic['id'], primary=False))) - return nic_list - - -def _get_existing_nics(vm): - network_profile = getattr(vm, 'network_profile', None) - nics = [] - if network_profile is not None: - nics = network_profile.network_interfaces or [] - return nics - - -def _update_vm_nics(cmd, vm, nics, primary_nic): - NetworkProfile = cmd.get_models('NetworkProfile') - - if primary_nic: - try: - _, primary_nic_name = _parse_rg_name(primary_nic) - except IndexError: - primary_nic_name = primary_nic - - matched = [n for n in nics if _parse_rg_name(n.id)[1].lower() == primary_nic_name.lower()] - if not matched: - raise CLIError('Primary Nic {} is not found'.format(primary_nic)) - if len(matched) > 1: - raise CLIError('Duplicate Nic entries with name {}'.format(primary_nic)) - for n in nics: - n.primary = False - matched[0].primary = True - elif nics: - if not [n for n in nics if n.primary]: - nics[0].primary = True - - network_profile = getattr(vm, 'network_profile', None) - if network_profile is None: - vm.network_profile = NetworkProfile(network_interfaces=nics) - else: - network_profile.network_interfaces = nics - - return set_vm(cmd, vm).network_profile.network_interfaces - - -# endregion - - -# region VirtualMachines RunCommand -def run_command_invoke(cmd, resource_group_name, vm_vmss_name, command_id, scripts=None, parameters=None, - instance_id=None): # pylint: disable=line-too-long - RunCommandInput, RunCommandInputParameter = cmd.get_models('RunCommandInput', 'RunCommandInputParameter') - - parameters = parameters or [] - run_command_input_parameters = [] - auto_arg_name_num = 0 - for p in parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - # RunCommand API requires named arguments, which doesn't make lots of sense for bash scripts - # using positional arguments, so here we provide names just to get API happy - # note, we don't handle mixing styles, but will consolidate by GA when API is settled - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command_input_parameters.append(RunCommandInputParameter(name=n, value=v)) - - client = _compute_client_factory(cmd.cli_ctx) - - # if instance_id, this is a vmss instance - if instance_id: - return client.virtual_machine_scale_set_vms.begin_run_command( - resource_group_name, vm_vmss_name, instance_id, - RunCommandInput(command_id=command_id, script=scripts, - parameters=run_command_input_parameters)) # pylint: disable=line-too-long - # otherwise this is a regular vm instance - return client.virtual_machines.begin_run_command( - resource_group_name, vm_vmss_name, - RunCommandInput(command_id=command_id, script=scripts, parameters=run_command_input_parameters)) - - -def vm_run_command_invoke(cmd, resource_group_name, vm_name, command_id, scripts=None, parameters=None): - return run_command_invoke(cmd, resource_group_name, vm_name, command_id, scripts, parameters) - - -def vm_run_command_create(client, - resource_group_name, - vm_name, - run_command_name, - location, - tags=None, - script=None, - script_uri=None, - command_id=None, - parameters=None, - protected_parameters=None, - async_execution=None, - run_as_user=None, - run_as_password=None, - timeout_in_seconds=None, - output_blob_uri=None, - error_blob_uri=None, - no_wait=False): - run_command = {} - run_command['location'] = location - if tags is not None: - run_command['tags'] = tags - source = {} - if script is not None: - source['script'] = script - if script_uri is not None: - source['script_uri'] = script_uri - if command_id is not None: - source['command_id'] = command_id - run_command['source'] = source - if parameters is not None: - auto_arg_name_num = 0 - run_command['parameters'] = [] - for p in parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command['parameters'].append({'name': n, 'value': v}) - if protected_parameters is not None: - auto_arg_name_num = 0 - run_command['protected_parameters'] = [] - for p in protected_parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command['protected_parameters'].append({'name': n, 'value': v}) - if async_execution is not None: - run_command['async_execution'] = async_execution - else: - run_command['async_execution'] = False - if run_as_user is not None: - run_command['run_as_user'] = run_as_user - if run_as_password is not None: - run_command['run_as_password'] = run_as_password - if timeout_in_seconds is not None: - run_command['timeout_in_seconds'] = timeout_in_seconds - if output_blob_uri is not None: - run_command['output_blob_uri'] = output_blob_uri - if error_blob_uri is not None: - run_command['error_blob_uri'] = error_blob_uri - return sdk_no_wait(no_wait, - client.begin_create_or_update, - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - run_command=run_command) - - -def vm_run_command_update(client, - resource_group_name, - vm_name, - run_command_name, - location, - tags=None, - script=None, - script_uri=None, - command_id=None, - parameters=None, - protected_parameters=None, - async_execution=None, - run_as_user=None, - run_as_password=None, - timeout_in_seconds=None, - output_blob_uri=None, - error_blob_uri=None, - no_wait=False): - run_command = {} - run_command['location'] = location - if tags is not None: - run_command['tags'] = tags - source = {} - if script is not None: - source['script'] = script - if script_uri is not None: - source['script_uri'] = script_uri - if command_id is not None: - source['command_id'] = command_id - run_command['source'] = source - if parameters is not None: - auto_arg_name_num = 0 - run_command['parameters'] = [] - for p in parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command['parameters'].append({'name': n, 'value': v}) - if protected_parameters is not None: - auto_arg_name_num = 0 - run_command['protected_parameters'] = [] - for p in protected_parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command['protected_parameters'].append({'name': n, 'value': v}) - if async_execution is not None: - run_command['async_execution'] = async_execution - else: - run_command['async_execution'] = False - if run_as_user is not None: - run_command['run_as_user'] = run_as_user - if run_as_password is not None: - run_command['run_as_password'] = run_as_password - if timeout_in_seconds is not None: - run_command['timeout_in_seconds'] = timeout_in_seconds - if output_blob_uri is not None: - run_command['output_blob_uri'] = output_blob_uri - if error_blob_uri is not None: - run_command['error_blob_uri'] = error_blob_uri - return sdk_no_wait(no_wait, - client.begin_update, - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name, - run_command=run_command) - - -def vm_run_command_delete(client, - resource_group_name, - vm_name, - run_command_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - vm_name=vm_name, - run_command_name=run_command_name) - - -def vm_run_command_list(client, - resource_group_name=None, - vm_name=None, - expand=None, - location=None): - if not location and not (resource_group_name and vm_name): - raise RequiredArgumentMissingError("Please specify --location or specify --vm-name and --resource-group") - - if vm_name: - return client.list_by_virtual_machine(resource_group_name=resource_group_name, vm_name=vm_name, expand=expand) - - return client.list(location=location) - - -def vm_run_command_show(client, - resource_group_name=None, - vm_name=None, - run_command_name=None, - expand=None, - instance_view=False, - location=None, - command_id=None): - if not (resource_group_name and vm_name and run_command_name) and not (location and command_id): - raise RequiredArgumentMissingError( - "Please specify --location and --command-id or specify --vm-name, --resource-group and --run-command-name") - - if vm_name: - if instance_view: - expand = 'instanceView' - return client.get_by_virtual_machine(resource_group_name=resource_group_name, vm_name=vm_name, - run_command_name=run_command_name, expand=expand) - - return client.get(location=location, command_id=command_id) - - -# endregion - - -# region VirtualMachines Secrets -def _get_vault_id_from_name(cli_ctx, client, vault_name): - group_name = _get_resource_group_from_vault_name(cli_ctx, vault_name) - if not group_name: - raise CLIError("unable to find vault '{}' in current subscription.".format(vault_name)) - vault = client.get(group_name, vault_name) - return vault.id - - -def get_vm_format_secret(cmd, secrets, certificate_store=None, keyvault=None, resource_group_name=None): - from azure.keyvault.secrets._shared import parse_key_vault_id - import re - client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_KEYVAULT).vaults - grouped_secrets = {} - - merged_secrets = [] - for s in secrets: - merged_secrets += s.splitlines() - - # group secrets by source vault - for secret in merged_secrets: - parsed = parse_key_vault_id(secret) - match = re.search('://(.+?)\\.', parsed.vault_url) - vault_name = match.group(1) - if vault_name not in grouped_secrets: - grouped_secrets[vault_name] = { - 'vaultCertificates': [], - 'id': keyvault or _get_vault_id_from_name(cmd.cli_ctx, client, vault_name) - } - - vault_cert = {'certificateUrl': secret} - if certificate_store: - vault_cert['certificateStore'] = certificate_store - - grouped_secrets[vault_name]['vaultCertificates'].append(vault_cert) - - # transform the reduced map to vm format - formatted = [{'sourceVault': {'id': value['id']}, - 'vaultCertificates': value['vaultCertificates']} - for _, value in list(grouped_secrets.items())] - - return formatted - - -def add_vm_secret(cmd, resource_group_name, vm_name, keyvault, certificate, certificate_store=None): - from azure.mgmt.core.tools import parse_resource_id - from ._vm_utils import create_data_plane_keyvault_certificate_client, get_key_vault_base_url - VaultSecretGroup, SubResource, VaultCertificate = cmd.get_models( - 'VaultSecretGroup', 'SubResource', 'VaultCertificate') - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - - if '://' not in certificate: # has a cert name rather a full url? - keyvault_client = create_data_plane_keyvault_certificate_client( - cmd.cli_ctx, get_key_vault_base_url(cmd.cli_ctx, parse_resource_id(keyvault)['name'])) - cert_info = keyvault_client.get_certificate(certificate) - certificate = cert_info.secret_id - - if not _is_linux_os(vm): - certificate_store = certificate_store or 'My' - elif certificate_store: - raise CLIError('Usage error: --certificate-store is only applicable on Windows VM') - vault_cert = VaultCertificate(certificate_url=certificate, certificate_store=certificate_store) - vault_secret_group = next((x for x in vm.os_profile.secrets - if x.source_vault and x.source_vault.id.lower() == keyvault.lower()), None) - if vault_secret_group: - vault_secret_group.vault_certificates.append(vault_cert) - else: - vault_secret_group = VaultSecretGroup(source_vault=SubResource(id=keyvault), vault_certificates=[vault_cert]) - vm.os_profile.secrets.append(vault_secret_group) - vm = set_vm(cmd, vm) - return vm.os_profile.secrets - - -def list_vm_secrets(cmd, resource_group_name, vm_name): - vm = get_vm(cmd, resource_group_name, vm_name) - if vm.os_profile: - return vm.os_profile.secrets - return [] - - -def remove_vm_secret(cmd, resource_group_name, vm_name, keyvault, certificate=None): - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - - # support 2 kinds of filter: - # a. if only keyvault is supplied, we delete its whole vault group. - # b. if both keyvault and certificate are supplied, we only delete the specific cert entry. - - to_keep = vm.os_profile.secrets - keyvault_matched = [] - if keyvault: - keyvault = keyvault.lower() - keyvault_matched = [x for x in to_keep if x.source_vault and x.source_vault.id.lower() == keyvault] - - if keyvault and not certificate: - to_keep = [x for x in to_keep if x not in keyvault_matched] - elif certificate: - temp = keyvault_matched if keyvault else to_keep - cert_url_pattern = certificate.lower() - if '://' not in cert_url_pattern: # just a cert name? - cert_url_pattern = '/' + cert_url_pattern + '/' - for x in temp: - x.vault_certificates = ([v for v in x.vault_certificates - if not (v.certificate_url and cert_url_pattern in v.certificate_url.lower())]) - to_keep = [x for x in to_keep if x.vault_certificates] # purge all groups w/o any cert entries - - vm.os_profile.secrets = to_keep - vm = set_vm(cmd, vm) - return vm.os_profile.secrets - - -# endregion - - -# region VirtualMachines UnmanagedDisks -def attach_unmanaged_data_disk(cmd, resource_group_name, vm_name, new=False, vhd_uri=None, lun=None, - disk_name=None, size_gb=1023, caching=None): - DataDisk, DiskCreateOptionTypes, VirtualHardDisk = cmd.get_models( - 'DataDisk', 'DiskCreateOptionTypes', 'VirtualHardDisk') - if not new and not disk_name: - raise CLIError('Please provide the name of the existing disk to attach') - create_option = DiskCreateOptionTypes.empty if new else DiskCreateOptionTypes.attach - - vm = get_vm_to_update(cmd, resource_group_name, vm_name) - if disk_name is None: - import datetime - disk_name = vm_name + '-' + datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S") - # pylint: disable=no-member - if vhd_uri is None: - if not hasattr(vm.storage_profile.os_disk, 'vhd') or not vm.storage_profile.os_disk.vhd: - raise CLIError('Adding unmanaged disks to a VM with managed disks is not supported') - blob_uri = vm.storage_profile.os_disk.vhd.uri - vhd_uri = blob_uri[0:blob_uri.rindex('/') + 1] + disk_name + '.vhd' - - if lun is None: - lun = _get_disk_lun(vm.storage_profile.data_disks) - disk = DataDisk(lun=lun, vhd=VirtualHardDisk(uri=vhd_uri), name=disk_name, - create_option=create_option, - caching=caching, disk_size_gb=size_gb if new else None) - if vm.storage_profile.data_disks is None: - vm.storage_profile.data_disks = [] - vm.storage_profile.data_disks.append(disk) - return set_vm(cmd, vm) - - -def list_unmanaged_disks(cmd, resource_group_name, vm_name): - vm = get_vm(cmd, resource_group_name, vm_name) - return vm.storage_profile.data_disks # pylint: disable=no-member - - -# endregion - - -# region VirtualMachines Users -def _update_linux_access_extension(cmd, vm_instance, resource_group_name, protected_settings, - no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - - VirtualMachineExtension = cmd.get_models('VirtualMachineExtension') - - # pylint: disable=no-member - instance_name = _get_extension_instance_name(vm_instance.instance_view, - extension_mappings[_LINUX_ACCESS_EXT]['publisher'], - _LINUX_ACCESS_EXT, - _ACCESS_EXT_HANDLER_NAME) - - publisher, version, auto_upgrade = _get_access_extension_upgrade_info( - vm_instance.resources, _LINUX_ACCESS_EXT) - - ext = VirtualMachineExtension(location=vm_instance.location, # pylint: disable=no-member - publisher=publisher, - type_properties_type=_LINUX_ACCESS_EXT, - protected_settings=protected_settings, - type_handler_version=version, - settings={}, - auto_upgrade_minor_version=auto_upgrade) - return sdk_no_wait(no_wait, client.virtual_machine_extensions.begin_create_or_update, - resource_group_name, vm_instance.name, instance_name, ext) - - -def _set_linux_user(cmd, vm_instance, resource_group_name, username, - password=None, ssh_key_value=None, no_wait=False): - protected_settings = {} - protected_settings['username'] = username - if password: - protected_settings['password'] = password - elif not ssh_key_value and not password: # default to ssh - ssh_key_value = os.path.join(os.path.expanduser('~'), '.ssh', 'id_rsa.pub') - - if ssh_key_value: - protected_settings['ssh_key'] = read_content_if_is_file(ssh_key_value) - - if no_wait: - return _update_linux_access_extension(cmd, vm_instance, resource_group_name, - protected_settings, no_wait) - poller = _update_linux_access_extension(cmd, vm_instance, resource_group_name, - protected_settings) - return ExtensionUpdateLongRunningOperation(cmd.cli_ctx, 'setting user', 'done')(poller) - - -def _reset_windows_admin(cmd, vm_instance, resource_group_name, username, password, no_wait=False): - '''Update the password. You can only change the password. Adding a new user is not supported. ''' - client = _compute_client_factory(cmd.cli_ctx) - VirtualMachineExtension = cmd.get_models('VirtualMachineExtension') - - publisher, version, auto_upgrade = _get_access_extension_upgrade_info( - vm_instance.resources, _WINDOWS_ACCESS_EXT) - # pylint: disable=no-member - instance_name = _get_extension_instance_name(vm_instance.instance_view, - publisher, - _WINDOWS_ACCESS_EXT, - _ACCESS_EXT_HANDLER_NAME) - - ext = VirtualMachineExtension(location=vm_instance.location, # pylint: disable=no-member - publisher=publisher, - type_properties_type=_WINDOWS_ACCESS_EXT, - protected_settings={'Password': password}, - type_handler_version=version, - settings={'UserName': username}, - auto_upgrade_minor_version=auto_upgrade) - - if no_wait: - return sdk_no_wait(no_wait, client.virtual_machine_extensions.create_or_update, - resource_group_name, vm_instance.name, instance_name, ext) - poller = client.virtual_machine_extensions.begin_create_or_update( - resource_group_name, vm_instance.name, instance_name, ext) - return ExtensionUpdateLongRunningOperation(cmd.cli_ctx, 'resetting admin', 'done')(poller) - - -def set_user(cmd, resource_group_name, vm_name, username, password=None, ssh_key_value=None, - no_wait=False): - vm = get_vm(cmd, resource_group_name, vm_name, 'instanceView') - if _is_linux_os(vm): - return _set_linux_user(cmd, vm, resource_group_name, username, password, ssh_key_value, no_wait) - if ssh_key_value: - raise CLIError('SSH key is not appliable on a Windows VM') - return _reset_windows_admin(cmd, vm, resource_group_name, username, password, no_wait) - - -def delete_user(cmd, resource_group_name, vm_name, username, no_wait=False): - vm = get_vm(cmd, resource_group_name, vm_name, 'instanceView') - if not _is_linux_os(vm): - raise CLIError('Deleting a user is not supported on Windows VM') - if no_wait: - return _update_linux_access_extension(cmd, vm, resource_group_name, - {'remove_user': username}, no_wait) - poller = _update_linux_access_extension(cmd, vm, resource_group_name, - {'remove_user': username}) - return ExtensionUpdateLongRunningOperation(cmd.cli_ctx, 'deleting user', 'done')(poller) - - -def reset_linux_ssh(cmd, resource_group_name, vm_name, no_wait=False): - vm = get_vm(cmd, resource_group_name, vm_name, 'instanceView') - if not _is_linux_os(vm): - raise CLIError('Resetting SSH is not supported in Windows VM') - if no_wait: - return _update_linux_access_extension(cmd, vm, resource_group_name, - {'reset_ssh': True}, no_wait) - poller = _update_linux_access_extension(cmd, vm, resource_group_name, - {'reset_ssh': True}) - return ExtensionUpdateLongRunningOperation(cmd.cli_ctx, 'resetting SSH', 'done')(poller) - - -# endregion - - -# region VirtualMachineScaleSets -def assign_vmss_identity(cmd, resource_group_name, vmss_name, assign_identity=None, identity_role=None, - identity_role_id=None, identity_scope=None): - VirtualMachineScaleSetIdentity, UpgradeMode, ResourceIdentityType, VirtualMachineScaleSetUpdate = cmd.get_models( - 'VirtualMachineScaleSetIdentity', 'UpgradeMode', 'ResourceIdentityType', 'VirtualMachineScaleSetUpdate') - IdentityUserAssignedIdentitiesValue = cmd.get_models( - 'VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue') or cmd.get_models('UserAssignedIdentitiesValue') - from azure.cli.core.commands.arm import assign_identity as assign_identity_helper - client = _compute_client_factory(cmd.cli_ctx) - _, _, external_identities, enable_local_identity = _build_identities_info(assign_identity) - - def getter(): - return client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - - def setter(vmss, external_identities=external_identities): - - if vmss.identity and vmss.identity.type == ResourceIdentityType.system_assigned_user_assigned: - identity_types = ResourceIdentityType.system_assigned_user_assigned - elif vmss.identity and vmss.identity.type == ResourceIdentityType.system_assigned and external_identities: - identity_types = ResourceIdentityType.system_assigned_user_assigned - elif vmss.identity and vmss.identity.type == ResourceIdentityType.user_assigned and enable_local_identity: - identity_types = ResourceIdentityType.system_assigned_user_assigned - elif external_identities and enable_local_identity: - identity_types = ResourceIdentityType.system_assigned_user_assigned - elif external_identities: - identity_types = ResourceIdentityType.user_assigned - else: - identity_types = ResourceIdentityType.system_assigned - vmss.identity = VirtualMachineScaleSetIdentity(type=identity_types) - if external_identities: - vmss.identity.user_assigned_identities = {} - for identity in external_identities: - vmss.identity.user_assigned_identities[identity] = IdentityUserAssignedIdentitiesValue() - vmss_patch = VirtualMachineScaleSetUpdate() - vmss_patch.identity = vmss.identity - poller = client.virtual_machine_scale_sets.begin_update(resource_group_name, vmss_name, vmss_patch) - return LongRunningOperation(cmd.cli_ctx)(poller) - - assign_identity_helper(cmd.cli_ctx, getter, setter, identity_role=identity_role_id, identity_scope=identity_scope) - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - if vmss.upgrade_policy.mode == UpgradeMode.manual: - logger.warning("With manual upgrade mode, you will need to run 'az vmss update-instances -g %s -n %s " - "--instance-ids *' to propagate the change", resource_group_name, vmss_name) - - return _construct_identity_info(identity_scope, identity_role, vmss.identity.principal_id, - vmss.identity.user_assigned_identities) - - -# pylint: disable=too-many-locals, too-many-statements -def create_vmss(cmd, vmss_name, resource_group_name, image=None, - disable_overprovision=None, instance_count=2, - location=None, tags=None, upgrade_policy_mode='manual', validate=False, - admin_username=None, admin_password=None, authentication_type=None, - vm_sku=None, no_wait=False, - ssh_dest_key_path=None, ssh_key_value=None, generate_ssh_keys=False, ssh_key_type=None, - load_balancer=None, load_balancer_sku=None, application_gateway=None, - app_gateway_subnet_address_prefix=None, - app_gateway_sku='Standard_Large', app_gateway_capacity=10, - backend_pool_name=None, nat_pool_name=None, backend_port=None, health_probe=None, - public_ip_address=None, public_ip_address_allocation=None, - public_ip_address_dns_name=None, accelerated_networking=None, - public_ip_per_vm=False, vm_domain_name=None, dns_servers=None, nsg=None, - os_caching=None, data_caching=None, - storage_container_name='vhds', storage_sku=None, - os_type=None, os_disk_name=None, - use_unmanaged_disk=False, data_disk_sizes_gb=None, disk_info=None, - vnet_name=None, vnet_address_prefix='10.0.0.0/16', - subnet=None, subnet_address_prefix=None, - os_offer=None, os_publisher=None, os_sku=None, os_version=None, - load_balancer_type=None, app_gateway_type=None, vnet_type=None, - public_ip_address_type=None, storage_profile=None, - single_placement_group=None, custom_data=None, secrets=None, platform_fault_domain_count=None, - plan_name=None, plan_product=None, plan_publisher=None, plan_promotion_code=None, license_type=None, - assign_identity=None, identity_scope=None, identity_role=None, - identity_role_id=None, zones=None, priority=None, eviction_policy=None, - application_security_groups=None, ultra_ssd_enabled=None, - ephemeral_os_disk=None, ephemeral_os_disk_placement=None, - proximity_placement_group=None, aux_subscriptions=None, terminate_notification_time=None, - max_price=None, computer_name_prefix=None, orchestration_mode=None, scale_in_policy=None, - os_disk_encryption_set=None, data_disk_encryption_sets=None, data_disk_iops=None, data_disk_mbps=None, - automatic_repairs_grace_period=None, specialized=None, os_disk_size_gb=None, encryption_at_host=None, - host_group=None, max_batch_instance_percent=None, max_unhealthy_instance_percent=None, - max_unhealthy_upgraded_instance_percent=None, pause_time_between_batches=None, - enable_cross_zone_upgrade=None, prioritize_unhealthy_instances=None, edge_zone=None, - user_data=None, network_api_version=None, enable_spot_restore=None, spot_restore_timeout=None, - capacity_reservation_group=None, enable_auto_update=None, patch_mode=None, enable_agent=None, - security_type=None, enable_secure_boot=None, enable_vtpm=None, automatic_repairs_action=None, - v_cpus_available=None, v_cpus_per_core=None, accept_term=None, - disable_integrity_monitoring=None, # Unused - enable_integrity_monitoring=False, enable_auto_os_upgrade=None, - os_disk_security_encryption_type=None, os_disk_secure_vm_disk_encryption_set=None, - os_disk_delete_option=None, data_disk_delete_option=None, regular_priority_count=None, - regular_priority_percentage=None, disk_controller_type=None, nat_rule_name=None, - enable_osimage_notification=None, max_surge=None, disable_integrity_monitoring_autoupgrade=False, - enable_hibernation=None, enable_proxy_agent=None, proxy_agent_mode=None, - security_posture_reference_id=None, security_posture_reference_exclude_extensions=None, - enable_resilient_creation=None, enable_resilient_deletion=None, - additional_scheduled_events=None, enable_user_reboot_scheduled_events=None, - enable_user_redeploy_scheduled_events=None, - skuprofile_vmsizes=None, skuprofile_allostrat=None): - from azure.cli.core.commands.client_factory import get_subscription_id - from azure.cli.core.util import random_string, hash_string - from azure.cli.core.commands.arm import ArmTemplateBuilder - from azure.cli.command_modules.vm.azure_stack._template_builder import (StorageProfile, build_vmss_resource, - build_vnet_resource, - build_public_ip_resource, - build_load_balancer_resource, - build_vmss_storage_account_pool_resource, - build_application_gateway_resource, - build_msi_role_assignment, - build_nsg_resource, - build_nat_rule_v2) - - # The default load balancer will be expected to be changed from Basic to Standard, and Basic will be removed. - # In order to avoid breaking change which has a big impact to users, - # we use the hint to guide users to use Standard load balancer to create VMSS in the first stage. - if load_balancer_sku == 'Basic': - logger.warning(remove_basic_option_msg, "--lb-sku Standard") - - # Build up the ARM template - master_template = ArmTemplateBuilder() - - uniform_str = 'Uniform' - flexible_str = 'Flexible' - if orchestration_mode: - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - - if disk_info: - storage_sku = disk_info['os'].get('storageAccountType') - - subscription_id = get_subscription_id(cmd.cli_ctx) - - if os_disk_encryption_set is not None and not is_valid_resource_id(os_disk_encryption_set): - os_disk_encryption_set = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=os_disk_encryption_set) - if os_disk_secure_vm_disk_encryption_set is not None and \ - not is_valid_resource_id(os_disk_secure_vm_disk_encryption_set): - os_disk_secure_vm_disk_encryption_set = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=os_disk_secure_vm_disk_encryption_set) - - if data_disk_encryption_sets is None: - data_disk_encryption_sets = [] - for i, des in enumerate(data_disk_encryption_sets): - if des is not None and not is_valid_resource_id(des): - data_disk_encryption_sets[i] = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=des) - - network_id_template = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Network') - - vmss_id = resource_id( - subscription=subscription_id, resource_group=resource_group_name, - namespace='Microsoft.Compute', type='virtualMachineScaleSets', name=vmss_name) - - scrubbed_name = vmss_name.replace('-', '').lower()[:5] - naming_prefix = '{}{}'.format(scrubbed_name, - hash_string(vmss_id, - length=(9 - len(scrubbed_name)), - force_lower=True)) - - # determine final defaults and calculated values - tags = tags or {} - os_disk_name = os_disk_name or ('osdisk_{}'.format(hash_string(vmss_id, length=10)) - if use_unmanaged_disk else None) - load_balancer = load_balancer or '{}LB'.format(vmss_name) - app_gateway = application_gateway or '{}AG'.format(vmss_name) - backend_pool_name = backend_pool_name or '{}BEPool'.format(load_balancer or application_gateway) - - vmss_dependencies = [] - - # VNET will always be a dependency - if vnet_type == 'new': - vnet_name = vnet_name or '{}VNET'.format(vmss_name) - subnet = subnet or '{}Subnet'.format(vmss_name) - vmss_dependencies.append('Microsoft.Network/virtualNetworks/{}'.format(vnet_name)) - vnet = build_vnet_resource( - cmd, vnet_name, location, tags, vnet_address_prefix, subnet, subnet_address_prefix, edge_zone=edge_zone) - if app_gateway_type: - vnet['properties']['subnets'].append({ - 'name': 'appGwSubnet', - 'properties': { - 'addressPrefix': app_gateway_subnet_address_prefix - } - }) - master_template.add_resource(vnet) - if subnet: - subnet_id = subnet if is_valid_resource_id(subnet) else \ - '{}/virtualNetworks/{}/subnets/{}'.format(network_id_template, vnet_name, subnet) - else: - subnet_id = None - - if vnet_name: - gateway_subnet_id = ('{}/virtualNetworks/{}/subnets/appGwSubnet'.format(network_id_template, vnet_name) - if app_gateway_type == 'new' else None) - else: - gateway_subnet_id = None - - # public IP is used by either load balancer/application gateway - public_ip_address_id = None - if public_ip_address: - public_ip_address_id = (public_ip_address if is_valid_resource_id(public_ip_address) - else '{}/publicIPAddresses/{}'.format(network_id_template, - public_ip_address)) - - def _get_public_ip_address_allocation(value, sku): - if not value: - value = 'Static' if (sku and sku.lower() == 'standard') else 'Dynamic' - return value - - # Handle load balancer creation - if load_balancer_type == 'new': - vmss_dependencies.append('Microsoft.Network/loadBalancers/{}'.format(load_balancer)) - - lb_dependencies = [] - if vnet_type == 'new': - lb_dependencies.append('Microsoft.Network/virtualNetworks/{}'.format(vnet_name)) - if public_ip_address_type == 'new': - public_ip_address = public_ip_address or '{}PublicIP'.format(load_balancer) - lb_dependencies.append( - 'Microsoft.Network/publicIpAddresses/{}'.format(public_ip_address)) - master_template.add_resource(build_public_ip_resource( - cmd, public_ip_address, location, tags, - _get_public_ip_address_allocation(public_ip_address_allocation, load_balancer_sku), - public_ip_address_dns_name, load_balancer_sku, zones, edge_zone=edge_zone)) - public_ip_address_id = '{}/publicIPAddresses/{}'.format(network_id_template, - public_ip_address) - - if nat_rule_name and nat_pool_name: - from azure.cli.core.azclierror import MutuallyExclusiveArgumentError - raise MutuallyExclusiveArgumentError( - 'Please do not pass in both "--nat-pool-name" and "--nat-rule-name" parameters at the same time.' - '"--nat-rule-name" parameter is recommended') - - is_basic_lb_sku = not load_balancer_sku or load_balancer_sku.lower() != 'standard' - # calculate default names if not provided - if orchestration_mode.lower() == flexible_str.lower(): - # inbound nat pools are not supported on VMSS Flex - nat_pool_name = None - elif nat_pool_name or (not nat_rule_name and is_basic_lb_sku): - nat_pool_name = nat_pool_name or '{}NatPool'.format(load_balancer) - - if not backend_port: - backend_port = 3389 if os_type == 'windows' else 22 - - frontend_ip_name = 'loadBalancerFrontEnd' - lb_resource = build_load_balancer_resource( - cmd, load_balancer, location, tags, backend_pool_name, nat_pool_name, backend_port, - frontend_ip_name, public_ip_address_id, subnet_id, private_ip_address='', - private_ip_allocation='Dynamic', sku=load_balancer_sku, instance_count=instance_count, - disable_overprovision=disable_overprovision, edge_zone=edge_zone) - lb_resource['dependsOn'] = lb_dependencies - master_template.add_resource(lb_resource) - - # Per https://learn.microsoft.com/azure/load-balancer/load-balancer-standard-overview#nsg - if load_balancer_sku and load_balancer_sku.lower() == 'standard' and nsg is None and os_type: - nsg_name = '{}NSG'.format(vmss_name) - master_template.add_resource(build_nsg_resource( - None, nsg_name, location, tags, 'rdp' if os_type.lower() == 'windows' else 'ssh')) - nsg = "[resourceId('Microsoft.Network/networkSecurityGroups', '{}')]".format(nsg_name) - vmss_dependencies.append('Microsoft.Network/networkSecurityGroups/{}'.format(nsg_name)) - - # Since NAT rule V2 can work for both Uniform and Flex VMSS, but basic LB SKU cannot fully support it - # So when users use Standard LB SKU, CLI uses NAT rule V2 by default - if not nat_pool_name: - - if nat_rule_name and is_basic_lb_sku: - logger.warning( - 'Since the basic SKU of load balancer cannot fully support NAT rule V2, ' - 'it is recommended to specify "--lb-sku Standard" to use standard SKU instead.') - - nat_rule_name = nat_rule_name or 'NatRule' - # The nested resource must follow the pattern parent_resource_name/nested_res_name - nat_rule_name = '{}/{}'.format(load_balancer, nat_rule_name) - nat_rule = build_nat_rule_v2(cmd, nat_rule_name, location, load_balancer, frontend_ip_name, - backend_pool_name, backend_port, instance_count, disable_overprovision) - master_template.add_resource(nat_rule) - - # Or handle application gateway creation - if app_gateway_type == 'new': - vmss_dependencies.append('Microsoft.Network/applicationGateways/{}'.format(app_gateway)) - - ag_dependencies = [] - if vnet_type == 'new': - ag_dependencies.append('Microsoft.Network/virtualNetworks/{}'.format(vnet_name)) - if public_ip_address_type == 'new': - public_ip_address = public_ip_address or '{}PublicIP'.format(app_gateway) - ag_dependencies.append( - 'Microsoft.Network/publicIpAddresses/{}'.format(public_ip_address)) - master_template.add_resource(build_public_ip_resource( - cmd, public_ip_address, location, tags, - _get_public_ip_address_allocation(public_ip_address_allocation, None), public_ip_address_dns_name, - None, zones)) - public_ip_address_id = '{}/publicIPAddresses/{}'.format(network_id_template, - public_ip_address) - - # calculate default names if not provided - backend_port = backend_port or 80 - - ag_resource = build_application_gateway_resource( - cmd, app_gateway, location, tags, backend_pool_name, backend_port, 'appGwFrontendIP', - public_ip_address_id, subnet_id, gateway_subnet_id, private_ip_address='', - private_ip_allocation='Dynamic', sku=app_gateway_sku, capacity=app_gateway_capacity) - ag_resource['dependsOn'] = ag_dependencies - master_template.add_variable( - 'appGwID', - "[resourceId('Microsoft.Network/applicationGateways', '{}')]".format(app_gateway)) - master_template.add_resource(ag_resource) - - # create storage accounts if needed for unmanaged disk storage - if storage_profile == StorageProfile.SAPirImage: - master_template.add_resource(build_vmss_storage_account_pool_resource( - cmd, 'storageLoop', location, tags, storage_sku, edge_zone)) - master_template.add_variable('storageAccountNames', [ - '{}{}'.format(naming_prefix, x) for x in range(5) - ]) - master_template.add_variable('vhdContainers', [ - "[concat('https://', variables('storageAccountNames')[{}], '.blob.{}/{}')]".format( - x, cmd.cli_ctx.cloud.suffixes.storage_endpoint, storage_container_name) for x in range(5) - ]) - vmss_dependencies.append('storageLoop') - - backend_address_pool_id = None - inbound_nat_pool_id = None - if load_balancer_type or app_gateway_type: - network_balancer = load_balancer if load_balancer_type else app_gateway - balancer_type = 'loadBalancers' if load_balancer_type else 'applicationGateways' - - if is_valid_resource_id(network_balancer): - # backend address pool needed by load balancer or app gateway - backend_address_pool_id = '{}/backendAddressPools/{}'.format(network_balancer, backend_pool_name) - if nat_pool_name: - inbound_nat_pool_id = '{}/inboundNatPools/{}'.format(network_balancer, nat_pool_name) - else: - # backend address pool needed by load balancer or app gateway - backend_address_pool_id = '{}/{}/{}/backendAddressPools/{}'.format( - network_id_template, balancer_type, network_balancer, backend_pool_name) - if nat_pool_name: - inbound_nat_pool_id = '{}/{}/{}/inboundNatPools/{}'.format( - network_id_template, balancer_type, network_balancer, nat_pool_name) - - if health_probe and not is_valid_resource_id(health_probe): - health_probe = '{}/loadBalancers/{}/probes/{}'.format(network_id_template, load_balancer, health_probe) - - ip_config_name = '{}IPConfig'.format(naming_prefix) - nic_name = '{}Nic'.format(naming_prefix) - - if custom_data: - custom_data = read_content_if_is_file(custom_data) - - if user_data: - user_data = read_content_if_is_file(user_data) - - if secrets: - secrets = _merge_secrets([validate_file_or_dict(secret) for secret in secrets]) - - if computer_name_prefix is not None and isinstance(computer_name_prefix, str): - naming_prefix = computer_name_prefix - - if orchestration_mode.lower() == uniform_str.lower(): - computer_name_prefix = naming_prefix - - if os_version and os_version != 'latest': - logger.warning('You are deploying VMSS pinned to a specific image version from Azure Marketplace. ' - 'Consider using "latest" as the image version.') - - vmss_resource = build_vmss_resource( - cmd=cmd, name=vmss_name, computer_name_prefix=computer_name_prefix, location=location, tags=tags, - overprovision=not disable_overprovision if orchestration_mode.lower() == uniform_str.lower() else None, - upgrade_policy_mode=upgrade_policy_mode, vm_sku=vm_sku, - instance_count=instance_count, ip_config_name=ip_config_name, nic_name=nic_name, subnet_id=subnet_id, - public_ip_per_vm=public_ip_per_vm, vm_domain_name=vm_domain_name, dns_servers=dns_servers, nsg=nsg, - accelerated_networking=accelerated_networking, admin_username=admin_username, - authentication_type=authentication_type, storage_profile=storage_profile, os_disk_name=os_disk_name, - disk_info=disk_info, os_type=os_type, image=image, admin_password=admin_password, - ssh_key_values=ssh_key_value, ssh_key_path=ssh_dest_key_path, os_publisher=os_publisher, os_offer=os_offer, - os_sku=os_sku, os_version=os_version, backend_address_pool_id=backend_address_pool_id, - inbound_nat_pool_id=inbound_nat_pool_id, health_probe=health_probe, - single_placement_group=single_placement_group, platform_fault_domain_count=platform_fault_domain_count, - custom_data=custom_data, secrets=secrets, license_type=license_type, zones=zones, priority=priority, - eviction_policy=eviction_policy, application_security_groups=application_security_groups, - ultra_ssd_enabled=ultra_ssd_enabled, proximity_placement_group=proximity_placement_group, - terminate_notification_time=terminate_notification_time, max_price=max_price, - scale_in_policy=scale_in_policy, os_disk_encryption_set=os_disk_encryption_set, - data_disk_encryption_sets=data_disk_encryption_sets, data_disk_iops=data_disk_iops, - data_disk_mbps=data_disk_mbps, automatic_repairs_grace_period=automatic_repairs_grace_period, - specialized=specialized, os_disk_size_gb=os_disk_size_gb, encryption_at_host=encryption_at_host, - host_group=host_group, max_batch_instance_percent=max_batch_instance_percent, - max_unhealthy_instance_percent=max_unhealthy_instance_percent, - max_unhealthy_upgraded_instance_percent=max_unhealthy_upgraded_instance_percent, - pause_time_between_batches=pause_time_between_batches, enable_cross_zone_upgrade=enable_cross_zone_upgrade, - prioritize_unhealthy_instances=prioritize_unhealthy_instances, edge_zone=edge_zone, user_data=user_data, - orchestration_mode=orchestration_mode, network_api_version=network_api_version, - enable_spot_restore=enable_spot_restore, spot_restore_timeout=spot_restore_timeout, - capacity_reservation_group=capacity_reservation_group, enable_auto_update=enable_auto_update, - patch_mode=patch_mode, enable_agent=enable_agent, security_type=security_type, - enable_secure_boot=enable_secure_boot, enable_vtpm=enable_vtpm, - automatic_repairs_action=automatic_repairs_action, v_cpus_available=v_cpus_available, - v_cpus_per_core=v_cpus_per_core, os_disk_security_encryption_type=os_disk_security_encryption_type, - os_disk_secure_vm_disk_encryption_set=os_disk_secure_vm_disk_encryption_set, - os_disk_delete_option=os_disk_delete_option, regular_priority_count=regular_priority_count, - regular_priority_percentage=regular_priority_percentage, disk_controller_type=disk_controller_type, - enable_osimage_notification=enable_osimage_notification, max_surge=max_surge, - enable_hibernation=enable_hibernation, enable_auto_os_upgrade=enable_auto_os_upgrade, - enable_proxy_agent=enable_proxy_agent, proxy_agent_mode=proxy_agent_mode, - security_posture_reference_id=security_posture_reference_id, - security_posture_reference_exclude_extensions=security_posture_reference_exclude_extensions, - enable_resilient_vm_creation=enable_resilient_creation, - enable_resilient_vm_deletion=enable_resilient_deletion, - additional_scheduled_events=additional_scheduled_events, - enable_user_reboot_scheduled_events=enable_user_reboot_scheduled_events, - enable_user_redeploy_scheduled_events=enable_user_redeploy_scheduled_events, - skuprofile_vmsizes=skuprofile_vmsizes, - skuprofile_allostrat=skuprofile_allostrat) - - vmss_resource['dependsOn'] = vmss_dependencies - - if plan_name: - vmss_resource['plan'] = { - 'name': plan_name, - 'publisher': plan_publisher, - 'product': plan_product, - 'promotionCode': plan_promotion_code - } - - enable_local_identity = None - if assign_identity is not None: - vmss_resource['identity'], _, _, enable_local_identity = _build_identities_info( - assign_identity) - if identity_scope: - role_assignment_guid = str(_gen_guid()) - master_template.add_resource(build_msi_role_assignment(vmss_name, vmss_id, identity_role_id, - role_assignment_guid, identity_scope, False)) - else: - raise CLIError('usage error: --orchestration-mode (Uniform | Flexible)') - - master_template.add_resource(vmss_resource) - master_template.add_output('VMSS', vmss_name, 'Microsoft.Compute', 'virtualMachineScaleSets', - output_type='object') - - if admin_password: - master_template.add_secure_parameter('adminPassword', admin_password) - - template = master_template.build() - parameters = master_template.build_parameters() - - # deploy ARM template - deployment_name = 'vmss_deploy_' + random_string(32) - client = get_mgmt_service_client(cmd.cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES, - aux_subscriptions=aux_subscriptions).deployments - - DeploymentProperties = cmd.get_models('DeploymentProperties', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) - properties = DeploymentProperties(template=template, parameters=parameters, mode='incremental') - - if validate: - from azure.cli.command_modules.vm.azure_stack._vm_utils import log_pprint_template - log_pprint_template(template) - log_pprint_template(parameters) - - Deployment = cmd.get_models('Deployment', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES) - deployment = Deployment(properties=properties) - if validate: - if cmd.supported_api_version(min_api='2019-10-01', resource_type=ResourceType.MGMT_RESOURCE_RESOURCES): - validation_poller = client.begin_validate(resource_group_name, deployment_name, deployment) - return LongRunningOperation(cmd.cli_ctx)(validation_poller) - - return client.validate(resource_group_name, deployment_name, deployment) - - # creates the VMSS deployment - deployment_result = DeploymentOutputLongRunningOperation(cmd.cli_ctx)( - sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, deployment_name, deployment)) - - if orchestration_mode.lower() == uniform_str.lower() and assign_identity is not None: - vmss_info = get_vmss(cmd, resource_group_name, vmss_name) - if enable_local_identity and not identity_scope: - _show_missing_access_warning(resource_group_name, vmss_name, 'vmss') - deployment_result['vmss']['identity'] = _construct_identity_info(identity_scope, identity_role, - vmss_info.identity.principal_id, - vmss_info.identity.user_assigned_identities) - # Guest Attestation Extension and enable System Assigned MSI by default - is_trusted_launch = security_type and security_type.lower() == 'trustedlaunch' and \ - enable_vtpm and enable_secure_boot - if is_trusted_launch and enable_integrity_monitoring: - client = _compute_client_factory(cmd.cli_ctx) - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - vmss.virtual_machine_profile.storage_profile.image_reference = None - VirtualMachineScaleSetExtension, VirtualMachineScaleSetExtensionProfile = cmd.get_models( - 'VirtualMachineScaleSetExtension', 'VirtualMachineScaleSetExtensionProfile') - if vmss.virtual_machine_profile.storage_profile.os_disk.os_type == 'Linux': - publisher = 'Microsoft.Azure.Security.LinuxAttestation' - if vmss.virtual_machine_profile.storage_profile.os_disk.os_type == 'Windows': - publisher = 'Microsoft.Azure.Security.WindowsAttestation' - version = _normalize_extension_version(cmd.cli_ctx, publisher, 'GuestAttestation', None, vmss.location) - ext = VirtualMachineScaleSetExtension(name='GuestAttestation', - publisher=publisher, - type_properties_type='GuestAttestation', - protected_settings=None, - type_handler_version=version, - settings=None, - auto_upgrade_minor_version=True, - provision_after_extensions=None, - enable_automatic_upgrade=not disable_integrity_monitoring_autoupgrade) - if not vmss.virtual_machine_profile.extension_profile: - vmss.virtual_machine_profile.extension_profile = VirtualMachineScaleSetExtensionProfile(extensions=[]) - vmss.virtual_machine_profile.extension_profile.extensions.append(ext) - try: - LongRunningOperation(cmd.cli_ctx)(client.virtual_machine_scale_sets.begin_create_or_update( - resource_group_name, vmss_name, vmss)) - logger.info('Guest Attestation Extension has been successfully installed by default' - 'when Trusted Launch configuration is met') - VirtualMachineScaleSetVMInstanceRequiredIDs = cmd.get_models('VirtualMachineScaleSetVMInstanceRequiredIDs') - instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs(instance_ids=['*']) - LongRunningOperation(cmd.cli_ctx)(client.virtual_machine_scale_sets.begin_update_instances( - resource_group_name, vmss_name, instance_ids)) - except Exception as e: - logger.error('Failed to install Guest Attestation Extension for Trusted Launch. %s', e) - - return deployment_result - - -def _build_identities_info(identities): - from ._vm_utils import MSI_LOCAL_ID - identities = identities or [] - identity_types = [] - if not identities or MSI_LOCAL_ID in identities: - identity_types.append('SystemAssigned') - external_identities = [x for x in identities if x != MSI_LOCAL_ID] - if external_identities: - identity_types.append('UserAssigned') - identity_types = ','.join(identity_types) - info = {'type': identity_types} - if external_identities: - info['userAssignedIdentities'] = {e: {} for e in external_identities} - return (info, identity_types, external_identities, 'SystemAssigned' in identity_types) - - -def _build_identities_info_from_system_user_assigned(cmd, mi_system_assigned, mi_user_assigned): - IdentityType, UserAssignedIdentitiesValue = cmd.get_models('DiskEncryptionSetIdentityType', - 'UserAssignedIdentitiesValue', - operation_group='disk_encryption_sets') - - identity_types = IdentityType.SYSTEM_ASSIGNED - user_assigned_identities = None - if mi_user_assigned: - if mi_system_assigned: - identity_types = IdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED - else: - identity_types = IdentityType.USER_ASSIGNED - - default_user_identity = UserAssignedIdentitiesValue() - user_assigned_identities = dict.fromkeys(mi_user_assigned, default_user_identity) - - return identity_types, user_assigned_identities - - -def deallocate_vmss(cmd, resource_group_name, vm_scale_set_name, instance_ids=None, no_wait=False, hibernate=None): - client = _compute_client_factory(cmd.cli_ctx) - # This is a walkaround because the REST service of `VirtualMachineScaleSetVMs#begin_deallocate` - # does not accept `hibernate` at present - if instance_ids and len(instance_ids) == 1 and hibernate is None: - return sdk_no_wait(no_wait, client.virtual_machine_scale_set_vms.begin_deallocate, - resource_group_name, vm_scale_set_name, instance_ids[0]) - - VirtualMachineScaleSetVMInstanceIDs = cmd.get_models('VirtualMachineScaleSetVMInstanceIDs') - vm_instance_i_ds = VirtualMachineScaleSetVMInstanceIDs(instance_ids=instance_ids) - if hibernate is not None: - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_deallocate, - resource_group_name, vm_scale_set_name, vm_instance_i_ds, hibernate=hibernate) - else: - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_deallocate, - resource_group_name, vm_scale_set_name, vm_instance_i_ds) - - -def delete_vmss_instances(cmd, resource_group_name, vm_scale_set_name, instance_ids, no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - VirtualMachineScaleSetVMInstanceRequiredIDs = cmd.get_models('VirtualMachineScaleSetVMInstanceRequiredIDs') - instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs(instance_ids=instance_ids) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_delete_instances, - resource_group_name, vm_scale_set_name, instance_ids) - - -def get_vmss(cmd, resource_group_name, name, instance_id=None, include_user_data=False): - client = _compute_client_factory(cmd.cli_ctx) - - expand = None - if include_user_data: - expand = 'userData' - - if instance_id is not None: - if cmd.supported_api_version(min_api='2020-12-01', operation_group='virtual_machine_scale_sets'): - return client.virtual_machine_scale_set_vms.get(resource_group_name=resource_group_name, - vm_scale_set_name=name, instance_id=instance_id, - expand=expand) - return client.virtual_machine_scale_set_vms.get(resource_group_name=resource_group_name, - vm_scale_set_name=name, instance_id=instance_id) - - if cmd.supported_api_version(min_api='2021-03-01', operation_group='virtual_machine_scale_sets'): - return client.virtual_machine_scale_sets.get(resource_group_name, name, expand=expand) - return client.virtual_machine_scale_sets.get(resource_group_name, name) - - -def _check_vmss_hyper_v_generation(cli_ctx, vmss): - hyper_v_generation = get_hyper_v_generation_from_vmss( - cli_ctx, vmss.virtual_machine_profile.storage_profile.image_reference, vmss.location) - security_profile = vmss.virtual_machine_profile.security_profile - security_type = security_profile.security_type if security_profile else None - - if hyper_v_generation == "V1" or (hyper_v_generation == "V2" and security_type is None): - logger.warning("Trusted Launch security type is supported on Hyper-V Generation 2 OS Images. " - "To know more please visit " - "https://learn.microsoft.com/en-us/azure/virtual-machines/trusted-launch") - elif hyper_v_generation == "V2" and security_type == "ConfidentialVM": - from azure.cli.core.azclierror import InvalidArgumentValueError - raise InvalidArgumentValueError("{} is already configured with {}. " - "Security Configuration cannot be updated from ConfidentialVM to " - "TrustedLaunch.".format(vmss.name, security_type)) - - -def get_vmss_modified(cmd, resource_group_name, name, instance_id=None, security_type=None): - client = _compute_client_factory(cmd.cli_ctx) - if instance_id is not None: - vms = client.virtual_machine_scale_set_vms.get(resource_group_name=resource_group_name, - vm_scale_set_name=name, instance_id=instance_id) - # To avoid unnecessary permission check of image - if hasattr(vms, "storage_profile") and vms.storage_profile: - vms.storage_profile.image_reference = None - return vms - - vmss = client.virtual_machine_scale_sets.get(resource_group_name, name) - if security_type == 'TrustedLaunch': - _check_vmss_hyper_v_generation(cmd.cli_ctx, vmss) - # To avoid unnecessary permission check of image - if hasattr(vmss, "virtual_machine_profile") and vmss.virtual_machine_profile \ - and vmss.virtual_machine_profile.storage_profile: - vmss.virtual_machine_profile.storage_profile.image_reference = None - return vmss - - -def get_vmss_instance_view(cmd, resource_group_name, vm_scale_set_name, instance_id=None): - client = _compute_client_factory(cmd.cli_ctx) - if instance_id: - if instance_id == '*': - return [x.instance_view for x in (client.virtual_machine_scale_set_vms.list( - resource_group_name=resource_group_name, virtual_machine_scale_set_name=vm_scale_set_name, - select='instanceView', expand='instanceView'))] - - return client.virtual_machine_scale_set_vms.get_instance_view(resource_group_name=resource_group_name, - vm_scale_set_name=vm_scale_set_name, - instance_id=instance_id) - - return client.virtual_machine_scale_sets.get_instance_view(resource_group_name, vm_scale_set_name) - - -def list_vmss_instance_connection_info(cmd, resource_group_name, vm_scale_set_name): - from azure.mgmt.core.tools import parse_resource_id - - LBShow = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.lb").Show - PublicIPAddress = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "network.public_ip").Show - - client = _compute_client_factory(cmd.cli_ctx) - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vm_scale_set_name) - - from ._vm_utils import raise_unsupported_error_for_flex_vmss - raise_unsupported_error_for_flex_vmss( - vmss, 'This command is not available for VMSS in Flex mode. ' - 'Please use the "az network public-ip list/show" to retrieve networking information.') - - # find the load balancer - nic_configs = vmss.virtual_machine_profile.network_profile.network_interface_configurations - primary_nic_config = next((n for n in nic_configs if n.primary), None) - if primary_nic_config is None: - raise CLIError('could not find a primary NIC which is needed to search to load balancer') - - res_id = None - for ip in primary_nic_config.ip_configurations: - if ip.load_balancer_inbound_nat_pools: - res_id = ip.load_balancer_inbound_nat_pools[0].id - break - if ip.load_balancer_backend_address_pools: - res_id = ip.load_balancer_backend_address_pools[0].id - break - - if not res_id: - raise ResourceNotFoundError('No load balancer exists to retrieve public IP address') - - lb_info = parse_resource_id(res_id) - lb_name = lb_info['name'] - lb_rg = lb_info['resource_group'] - - # get public ip - lb = LBShow(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': lb_name, - 'resource_group': lb_rg - }) - if 'publicIPAddress' in lb['frontendIPConfigurations'][0]: - res_id = lb['frontendIPConfigurations'][0]['publicIPAddress']['id'] - public_ip_info = parse_resource_id(res_id) - public_ip_name = public_ip_info['name'] - public_ip_rg = public_ip_info['resource_group'] - public_ip = PublicIPAddress(cli_ctx=cmd.cli_ctx)(command_args={ - 'name': public_ip_name, - 'resource_group': public_ip_rg - }) - public_ip_address = public_ip['ipAddress'] if 'ipAddress' in public_ip else None - # For NAT pool, get the frontend port and VMSS instance from inboundNatRules - is_nat_pool = True - instance_addresses = {} - for rule in lb['inboundNatRules']: - # If backend_ip_configuration does not exist, it means that NAT rule V2 is used - if 'backendIPConfiguration' not in rule or not rule['backendIPConfiguration']: - is_nat_pool = False - break - instance_id = parse_resource_id(rule['backendIPConfiguration']['id'])['child_name_1'] - instance_addresses['instance ' + instance_id] = '{}:{}'.format(public_ip_address, - rule['frontendPort']) - if is_nat_pool: - return instance_addresses - - # For NAT rule V2, get the frontend port and VMSS instance from loadBalancerBackendAddresses - for backend_address_pool in lb['backendAddressPools']: - if 'loadBalancerBackendAddresses' not in backend_address_pool or \ - not backend_address_pool['loadBalancerBackendAddresses']: - raise CLIError('There is no connection information. ' - 'If you are using NAT rule V2, please confirm whether the load balancer SKU is Standard') - - for load_balancer_backend_addresse in backend_address_pool['loadBalancerBackendAddresses']: - - network_interface_ip_configuration = load_balancer_backend_addresse['networkInterfaceIPConfiguration'] - if not network_interface_ip_configuration or 'id' not in network_interface_ip_configuration: - continue - instance_id = parse_resource_id(network_interface_ip_configuration['id'])['child_name_1'] - - if not load_balancer_backend_addresse['inboundNatRulesPortMapping']: - continue - frontend_port = load_balancer_backend_addresse['inboundNatRulesPortMapping'][0]['frontendPort'] - instance_addresses['instance ' + instance_id] = '{}:{}'.format(public_ip_address, frontend_port) - - return instance_addresses - raise CLIError('The VM scale-set uses an internal load balancer, hence no connection information') - - -def list_vmss_instance_public_ips(cmd, resource_group_name, vm_scale_set_name): - ListInstancePublicIps = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "vmss").ListInstancePublicIps - - compute_client = _compute_client_factory(cmd.cli_ctx) - vmss = compute_client.virtual_machine_scale_sets.get(resource_group_name, vm_scale_set_name) - from ._vm_utils import raise_unsupported_error_for_flex_vmss - raise_unsupported_error_for_flex_vmss( - vmss, 'This command is not available for VMSS in Flex mode. ' - 'Please use the "az network public-ip list/show" to retrieve networking information.') - - result = ListInstancePublicIps(cli_ctx=cmd.cli_ctx)(command_args={ - 'vmss_name': vm_scale_set_name, - 'resource_group': resource_group_name - }) - # filter away over-provisioned instances which are deleted after 'create/update' returns - return [r for r in result if 'ipAddress' in r and r['ipAddress']] - - -def reimage_vmss(cmd, resource_group_name, vm_scale_set_name, instance_ids=None, - force_update_os_disk_for_ephemeral=None, no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - if instance_ids: - VirtualMachineScaleSetVMInstanceIDs = cmd.get_models('VirtualMachineScaleSetVMInstanceIDs') - instance_ids = VirtualMachineScaleSetVMInstanceIDs(instance_ids=instance_ids) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_reimage_all, resource_group_name, - vm_scale_set_name, instance_ids) - if force_update_os_disk_for_ephemeral is not None: - VirtualMachineScaleSetReimageParameters = cmd.get_models('VirtualMachineScaleSetReimageParameters') - vm_scale_set_reimage_input = VirtualMachineScaleSetReimageParameters( - force_update_os_disk_for_ephemeral=force_update_os_disk_for_ephemeral) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_reimage, - resource_group_name, vm_scale_set_name, vm_scale_set_reimage_input) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_reimage, - resource_group_name, vm_scale_set_name) - - -def restart_vmss(cmd, resource_group_name, vm_scale_set_name, instance_ids=None, no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - VirtualMachineScaleSetVMInstanceRequiredIDs = cmd.get_models('VirtualMachineScaleSetVMInstanceRequiredIDs') - if instance_ids is None: - instance_ids = ['*'] - instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs(instance_ids=instance_ids) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_restart, resource_group_name, vm_scale_set_name, - vm_instance_i_ds=instance_ids) - - -# pylint: disable=inconsistent-return-statements -def scale_vmss(cmd, resource_group_name, vm_scale_set_name, new_capacity, no_wait=False): - VirtualMachineScaleSet = cmd.get_models('VirtualMachineScaleSet') - client = _compute_client_factory(cmd.cli_ctx) - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vm_scale_set_name) - # pylint: disable=no-member - if vmss.sku.capacity == new_capacity: - return - - vmss.sku.capacity = new_capacity - vmss_new = VirtualMachineScaleSet(location=vmss.location, sku=vmss.sku) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_create_or_update, - resource_group_name, vm_scale_set_name, vmss_new) - - -def start_vmss(cmd, resource_group_name, vm_scale_set_name, instance_ids=None, no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - VirtualMachineScaleSetVMInstanceRequiredIDs = cmd.get_models('VirtualMachineScaleSetVMInstanceRequiredIDs') - if instance_ids is None: - instance_ids = ['*'] - instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs(instance_ids=instance_ids) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_start, - resource_group_name, vm_scale_set_name, vm_instance_i_ds=instance_ids) - - -def stop_vmss(cmd, resource_group_name, vm_scale_set_name, instance_ids=None, no_wait=False, skip_shutdown=False): - client = _compute_client_factory(cmd.cli_ctx) - VirtualMachineScaleSetVMInstanceRequiredIDs = cmd.get_models('VirtualMachineScaleSetVMInstanceRequiredIDs') - if instance_ids is None: - instance_ids = ['*'] - instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs(instance_ids=instance_ids) - if cmd.supported_api_version(min_api='2020-06-01', operation_group='virtual_machine_scale_sets'): - return sdk_no_wait( - no_wait, client.virtual_machine_scale_sets.begin_power_off, resource_group_name, vm_scale_set_name, - vm_instance_i_ds=instance_ids, skip_shutdown=skip_shutdown) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_power_off, resource_group_name, - vm_scale_set_name, vm_instance_i_ds=instance_ids) - - -def update_vmss_instances(cmd, resource_group_name, vm_scale_set_name, instance_ids, no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - VirtualMachineScaleSetVMInstanceRequiredIDs = cmd.get_models('VirtualMachineScaleSetVMInstanceRequiredIDs') - instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs(instance_ids=instance_ids) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_update_instances, - resource_group_name, vm_scale_set_name, instance_ids) - - -def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False, instance_id=None, - protect_from_scale_in=None, protect_from_scale_set_actions=None, - enable_terminate_notification=None, terminate_notification_time=None, ultra_ssd_enabled=None, - scale_in_policy=None, priority=None, max_price=None, proximity_placement_group=None, - enable_automatic_repairs=None, automatic_repairs_grace_period=None, max_batch_instance_percent=None, - max_unhealthy_instance_percent=None, max_unhealthy_upgraded_instance_percent=None, - pause_time_between_batches=None, enable_cross_zone_upgrade=None, prioritize_unhealthy_instances=None, - user_data=None, enable_spot_restore=None, spot_restore_timeout=None, capacity_reservation_group=None, - vm_sku=None, ephemeral_os_disk_placement=None, force_deletion=None, enable_secure_boot=None, - enable_vtpm=None, automatic_repairs_action=None, v_cpus_available=None, v_cpus_per_core=None, - regular_priority_count=None, regular_priority_percentage=None, disk_controller_type=None, - enable_osimage_notification=None, custom_data=None, enable_hibernation=None, - security_type=None, enable_proxy_agent=None, proxy_agent_mode=None, - security_posture_reference_id=None, security_posture_reference_exclude_extensions=None, - max_surge=None, enable_resilient_creation=None, enable_resilient_deletion=None, - ephemeral_os_disk=None, ephemeral_os_disk_option=None, zones=None, additional_scheduled_events=None, - enable_user_reboot_scheduled_events=None, enable_user_redeploy_scheduled_events=None, - upgrade_policy_mode=None, enable_auto_os_upgrade=None, - skuprofile_vmsizes=None, skuprofile_allostrat=None, **kwargs): - vmss = kwargs['parameters'] - aux_subscriptions = None - # pylint: disable=too-many-boolean-expressions - if vmss and hasattr(vmss, 'virtual_machine_profile') and vmss.virtual_machine_profile and \ - vmss.virtual_machine_profile.storage_profile and \ - vmss.virtual_machine_profile.storage_profile.image_reference and \ - 'id' in vmss.virtual_machine_profile.storage_profile.image_reference: - aux_subscriptions = _parse_aux_subscriptions(vmss.virtual_machine_profile.storage_profile.image_reference['id']) - client = _compute_client_factory(cmd.cli_ctx, aux_subscriptions=aux_subscriptions) - - VMProtectionPolicy = cmd.get_models('VirtualMachineScaleSetVMProtectionPolicy') - - # handle vmss instance update - from azure.cli.core.util import b64encode - - if instance_id is not None: - if license_type is not None: - vmss.license_type = license_type - - if user_data is not None: - vmss.user_data = b64encode(user_data) - - if not vmss.protection_policy: - vmss.protection_policy = VMProtectionPolicy() - - if protect_from_scale_in is not None: - vmss.protection_policy.protect_from_scale_in = protect_from_scale_in - - if protect_from_scale_set_actions is not None: - vmss.protection_policy.protect_from_scale_set_actions = protect_from_scale_set_actions - - return sdk_no_wait(no_wait, client.virtual_machine_scale_set_vms.begin_update, - resource_group_name, name, instance_id, **kwargs) - - # else handle vmss update - if license_type is not None: - vmss.virtual_machine_profile.license_type = license_type - - if user_data is not None: - vmss.virtual_machine_profile.user_data = b64encode(user_data) - - if v_cpus_available is not None or v_cpus_per_core is not None: - HardwareProfile = cmd.get_models('HardwareProfile') - VMSizeProperties = cmd.get_models('VMSizeProperties') - hardware_profile = HardwareProfile(vm_size_properties=VMSizeProperties(v_cpus_available=v_cpus_available, - v_cpus_per_core=v_cpus_per_core)) - vmss.virtual_machine_profile.hardware_profile = hardware_profile - - if capacity_reservation_group is not None: - CapacityReservationProfile = cmd.get_models('CapacityReservationProfile') - SubResource = cmd.get_models('SubResource') - if capacity_reservation_group == 'None': - capacity_reservation_group = None - sub_resource = SubResource(id=capacity_reservation_group) - capacity_reservation = CapacityReservationProfile(capacity_reservation_group=sub_resource) - vmss.virtual_machine_profile.capacity_reservation = capacity_reservation - - if enable_terminate_notification is not None or terminate_notification_time is not None: - if vmss.virtual_machine_profile.scheduled_events_profile is None: - ScheduledEventsProfile = cmd.get_models('ScheduledEventsProfile') - vmss.virtual_machine_profile.scheduled_events_profile = ScheduledEventsProfile() - TerminateNotificationProfile = cmd.get_models('TerminateNotificationProfile') - vmss.virtual_machine_profile.scheduled_events_profile.terminate_notification_profile = \ - TerminateNotificationProfile(not_before_timeout=terminate_notification_time, - enable=enable_terminate_notification) - - if additional_scheduled_events is not None or \ - enable_user_reboot_scheduled_events is not None or enable_user_redeploy_scheduled_events is not None: - if vmss.scheduled_events_policy is None: - ScheduledEventsPolicy = cmd.get_models('ScheduledEventsPolicy') - UserInitiatedRedeploy = cmd.get_models('UserInitiatedRedeploy') - UserInitiatedReboot = cmd.get_models('UserInitiatedReboot') - EventGridAndResourceGraph = cmd.get_models('EventGridAndResourceGraph') - ScheduledEventsAdditionalPublishingTargets = cmd.get_models('ScheduledEventsAdditionalPublishingTargets') - vmss.scheduled_events_policy = ScheduledEventsPolicy() - vmss.scheduled_events_policy.scheduled_events_additional_publishing_targets = \ - ScheduledEventsAdditionalPublishingTargets() - vmss.scheduled_events_policy.scheduled_events_additional_publishing_targets. \ - event_grid_and_resource_graph = EventGridAndResourceGraph() - vmss.scheduled_events_policy.user_initiated_reboot = UserInitiatedReboot() - vmss.scheduled_events_policy.user_initiated_redeploy = UserInitiatedRedeploy() - vmss.scheduled_events_policy.scheduled_events_additional_publishing_targets. \ - event_grid_and_resource_graph.enable = additional_scheduled_events - vmss.scheduled_events_policy.user_initiated_redeploy.automatically_approve = \ - enable_user_redeploy_scheduled_events - vmss.scheduled_events_policy.user_initiated_reboot.automatically_approve = enable_user_reboot_scheduled_events - - if enable_osimage_notification is not None: - if vmss.virtual_machine_profile.scheduled_events_profile is None: - vmss.virtual_machine_profile.scheduled_events_profile = cmd.get_models('ScheduledEventsProfile')() - OSImageNotificationProfile = cmd.get_models('OSImageNotificationProfile') - vmss.virtual_machine_profile.scheduled_events_profile.os_image_notification_profile = \ - OSImageNotificationProfile(enable=enable_osimage_notification) - if enable_automatic_repairs is not None or \ - automatic_repairs_grace_period is not None or automatic_repairs_action is not None: - AutomaticRepairsPolicy = cmd.get_models('AutomaticRepairsPolicy') - vmss.automatic_repairs_policy = \ - AutomaticRepairsPolicy(enabled=enable_automatic_repairs, - grace_period=automatic_repairs_grace_period, - repair_action=automatic_repairs_action) - - if ultra_ssd_enabled is not None: - if cmd.supported_api_version(min_api='2019-03-01', operation_group='virtual_machine_scale_sets'): - if vmss.additional_capabilities is None: - AdditionalCapabilities = cmd.get_models('AdditionalCapabilities') - vmss.additional_capabilities = AdditionalCapabilities(ultra_ssd_enabled=ultra_ssd_enabled) - else: - vmss.additional_capabilities.ultra_ssd_enabled = ultra_ssd_enabled - else: - if vmss.virtual_machine_profile.additional_capabilities is None: - AdditionalCapabilities = cmd.get_models('AdditionalCapabilities') - vmss.virtual_machine_profile.additional_capabilities = AdditionalCapabilities( - ultra_ssd_enabled=ultra_ssd_enabled) - else: - vmss.virtual_machine_profile.additional_capabilities.ultra_ssd_enabled = ultra_ssd_enabled - - if scale_in_policy is not None or force_deletion is not None: - ScaleInPolicy = cmd.get_models('ScaleInPolicy') - vmss.scale_in_policy = ScaleInPolicy(rules=scale_in_policy, force_deletion=force_deletion) - - if enable_spot_restore is not None: - vmss.spot_restore_policy.enabled = enable_spot_restore - - if spot_restore_timeout is not None: - vmss.spot_restore_policy.restore_timeout = spot_restore_timeout - - if priority is not None: - vmss.virtual_machine_profile.priority = priority - - if max_price is not None: - if vmss.virtual_machine_profile.billing_profile is None: - BillingProfile = cmd.get_models('BillingProfile') - vmss.virtual_machine_profile.billing_profile = BillingProfile(max_price=max_price) - else: - vmss.virtual_machine_profile.billing_profile.max_price = max_price - - if security_type is not None or enable_secure_boot is not None or enable_vtpm is not None: - security_profile = vmss.virtual_machine_profile.security_profile - prev_security_type = security_profile.security_type if security_profile else None - # At present, `SecurityType` has options `TrustedLaunch` and `Standard` - if security_type == 'TrustedLaunch' and prev_security_type != security_type: - vmss.virtual_machine_profile.security_profile = { - 'securityType': security_type, - 'uefiSettings': { - 'secureBootEnabled': enable_secure_boot if enable_secure_boot is not None else False, - 'vTpmEnabled': enable_vtpm if enable_vtpm is not None else True - } - } - elif security_type == 'Standard': - if prev_security_type == 'TrustedLaunch': - logger.warning('Turning off Trusted launch disables foundational security for your VMs. ' - 'For more information, visit https://aka.ms/TrustedLaunch') - vmss.virtual_machine_profile.security_profile = { - 'securityType': security_type, - 'uefiSettings': None - } - else: - vmss.virtual_machine_profile.security_profile = {'uefiSettings': { - 'secureBootEnabled': enable_secure_boot, - 'vTpmEnabled': enable_vtpm - }} - - if enable_proxy_agent is not None or proxy_agent_mode is not None: - SecurityProfile = cmd.get_models('SecurityProfile') - ProxyAgentSettings = cmd.get_models('ProxyAgentSettings') - if vmss.virtual_machine_profile.security_profile is None: - vmss.virtual_machine_profile.security_profile = SecurityProfile() - vmss.virtual_machine_profile.security_profile.proxy_agent_settings = ProxyAgentSettings( - enabled=enable_proxy_agent, mode=proxy_agent_mode) - elif vmss.virtual_machine_profile.security_profile.proxy_agent_settings is None: - vmss.virtual_machine_profile.security_profile.proxy_agent_settings = ProxyAgentSettings( - enabled=enable_proxy_agent, mode=proxy_agent_mode) - else: - vmss.virtual_machine_profile.security_profile.proxy_agent_settings.enabled = enable_proxy_agent - vmss.virtual_machine_profile.security_profile.proxy_agent_settings.mode = proxy_agent_mode - - if regular_priority_count is not None or regular_priority_percentage is not None: - if vmss.orchestration_mode != 'Flexible': - raise ValidationError("--regular-priority-count/--regular-priority-percentage is only available for" - " VMSS with flexible orchestration mode") - if vmss.priority_mix_policy is None: - vmss.priority_mix_policy = { - 'baseRegularPriorityCount': regular_priority_count, - 'regularPriorityPercentageAboveBase': regular_priority_percentage - } - else: - if regular_priority_count is not None: - vmss.priority_mix_policy.base_regular_priority_count = regular_priority_count - if regular_priority_percentage is not None: - vmss.priority_mix_policy.regular_priority_percentage_above_base = regular_priority_percentage - - if proximity_placement_group is not None: - vmss.proximity_placement_group = {'id': proximity_placement_group} - - if max_batch_instance_percent is not None or max_unhealthy_instance_percent is not None \ - or max_unhealthy_upgraded_instance_percent is not None or pause_time_between_batches is not None \ - or enable_cross_zone_upgrade is not None or prioritize_unhealthy_instances is not None \ - or max_surge is not None: - if vmss.upgrade_policy is None: - vmss.upgrade_policy = {'rolling_upgrade_policy': None} - if vmss.upgrade_policy.rolling_upgrade_policy is None: - vmss.upgrade_policy.rolling_upgrade_policy = { - 'maxBatchInstancePercent': max_batch_instance_percent, - 'maxUnhealthyInstancePercent': max_unhealthy_instance_percent, - 'maxUnhealthyUpgradedInstancePercent': max_unhealthy_upgraded_instance_percent, - 'pauseTimeBetweenBatches': pause_time_between_batches, - 'enableCrossZoneUpgrade': enable_cross_zone_upgrade, - 'prioritizeUnhealthyInstances': prioritize_unhealthy_instances, - 'maxSurge': max_surge - } - else: - vmss.upgrade_policy.rolling_upgrade_policy.max_batch_instance_percent = max_batch_instance_percent - vmss.upgrade_policy.rolling_upgrade_policy.max_unhealthy_instance_percent = max_unhealthy_instance_percent - vmss.upgrade_policy.rolling_upgrade_policy.max_unhealthy_upgraded_instance_percent = \ - max_unhealthy_upgraded_instance_percent - vmss.upgrade_policy.rolling_upgrade_policy.pause_time_between_batches = pause_time_between_batches - vmss.upgrade_policy.rolling_upgrade_policy.enable_cross_zone_upgrade = enable_cross_zone_upgrade - vmss.upgrade_policy.rolling_upgrade_policy.prioritize_unhealthy_instances = prioritize_unhealthy_instances - vmss.upgrade_policy.rolling_upgrade_policy.max_surge = max_surge - - if upgrade_policy_mode is not None: - vmss.upgrade_policy.mode = upgrade_policy_mode - - if enable_auto_os_upgrade is not None: - if vmss.upgrade_policy.automatic_os_upgrade_policy is None: - vmss.upgrade_policy.automatic_os_upgrade_policy = {'enableAutomaticOSUpgrade': enable_auto_os_upgrade} - else: - vmss.upgrade_policy.automatic_os_upgrade_policy.enable_automatic_os_upgrade = enable_auto_os_upgrade - - if vm_sku is not None: - if vmss.sku.name == vm_sku: - logger.warning("VMSS sku is already %s", vm_sku) - else: - vmss.sku.name = vm_sku - - sku_profile = {} - if skuprofile_vmsizes is not None or skuprofile_allostrat is not None: - if skuprofile_vmsizes is not None: - sku_profile_vmsizes_list = [] - for vm_size in skuprofile_vmsizes: - vmsize_obj = { - 'name': vm_size - } - sku_profile_vmsizes_list.append(vmsize_obj) - sku_profile['vmSizes'] = sku_profile_vmsizes_list - if skuprofile_allostrat is not None: - sku_profile['allocationStrategy'] = skuprofile_allostrat - vmss.sku_profile = sku_profile - - if ephemeral_os_disk_placement is not None or ephemeral_os_disk_option is not None: - if vmss.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings is not None: - vmss.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings.placement = \ - ephemeral_os_disk_placement - vmss.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings.option = \ - ephemeral_os_disk_option - else: - DiffDiskSettings = cmd.get_models('DiffDiskSettings') - vmss.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings = DiffDiskSettings( - option=ephemeral_os_disk_option, placement=ephemeral_os_disk_placement) - - if ephemeral_os_disk is False: - vmss.virtual_machine_profile.storage_profile.os_disk.diff_disk_settings = {} - - if disk_controller_type is not None: - vmss.virtual_machine_profile.storage_profile.disk_controller_type = disk_controller_type - - if custom_data is not None: - custom_data = read_content_if_is_file(custom_data) - vmss.virtual_machine_profile.os_profile.custom_data = b64encode(custom_data) - - if enable_hibernation is not None: - if vmss.additional_capabilities is None: - AdditionalCapabilities = cmd.get_models('AdditionalCapabilities') - vmss.additional_capabilities = AdditionalCapabilities(hibernation_enabled=enable_hibernation) - else: - vmss.additional_capabilities.hibernation_enabled = enable_hibernation - - if security_posture_reference_id is not None or security_posture_reference_exclude_extensions is not None: - security_posture_reference = vmss.virtual_machine_profile.security_posture_reference - if security_posture_reference is None: - SecurityPostureReference = cmd.get_models('SecurityPostureReference') - security_posture_reference = SecurityPostureReference() - - if security_posture_reference_id is not None: - security_posture_reference.id = security_posture_reference_id - if security_posture_reference_exclude_extensions is not None: - security_posture_reference.exclude_extensions = security_posture_reference_exclude_extensions - - vmss.virtual_machine_profile.security_posture_reference = security_posture_reference - - if enable_resilient_creation is not None or enable_resilient_deletion is not None: - resiliency_policy = vmss.resiliency_policy - if enable_resilient_creation is not None: - resiliency_policy.resilient_vm_creation_policy = {'enabled': enable_resilient_creation} - if enable_resilient_deletion is not None: - resiliency_policy.resilient_vm_deletion_policy = {'enabled': enable_resilient_deletion} - - if zones is not None: - vmss.zones = zones - - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_create_or_update, - resource_group_name, name, **kwargs) - - -# endregion - - -# region VirtualMachineScaleSets Diagnostics -def set_vmss_diagnostics_extension( - cmd, resource_group_name, vmss_name, settings, protected_settings=None, version=None, - no_auto_upgrade=False): - client = _compute_client_factory(cmd.cli_ctx) - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - # pylint: disable=no-member - is_linux_os = _is_linux_os(vmss.virtual_machine_profile) - vm_extension_name = _LINUX_DIAG_EXT if is_linux_os else _WINDOWS_DIAG_EXT - if is_linux_os and vmss.virtual_machine_profile.extension_profile: # check incompatibles - exts = vmss.virtual_machine_profile.extension_profile.extensions or [] - major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0] - # For VMSS, we don't do auto-removal like VM because there is no reliable API to wait for - # the removal done before we can install the newer one - if next((e for e in exts if e.name == _LINUX_DIAG_EXT and - not e.type_handler_version.startswith(major_ver + '.')), None): - delete_cmd = 'az vmss extension delete -g {} --vmss-name {} -n {}'.format( - resource_group_name, vmss_name, vm_extension_name) - raise CLIError("There is an incompatible version of diagnostics extension installed. " - "Please remove it by running '{}', and retry. 'az vmss update-instances'" - " might be needed if with manual upgrade policy".format(delete_cmd)) - - poller = set_vmss_extension(cmd, resource_group_name, vmss_name, vm_extension_name, - extension_mappings[vm_extension_name]['publisher'], - version or extension_mappings[vm_extension_name]['version'], - settings, - protected_settings, - no_auto_upgrade) - - result = LongRunningOperation(cmd.cli_ctx)(poller) - UpgradeMode = cmd.get_models('UpgradeMode') - if vmss.upgrade_policy.mode == UpgradeMode.manual: - poller2 = update_vmss_instances(cmd, resource_group_name, vmss_name, ['*']) - LongRunningOperation(cmd.cli_ctx)(poller2) - return result - - -# endregion - - -# region VirtualMachineScaleSets Disks (Managed) -def attach_managed_data_disk_to_vmss(cmd, resource_group_name, vmss_name, size_gb=None, instance_id=None, lun=None, - caching=None, disk=None, sku=None): - def _init_data_disk(storage_profile, lun, existing_disk=None): - data_disks = storage_profile.data_disks or [] - if lun is None: - lun = _get_disk_lun(data_disks) - if existing_disk is None: - data_disk = DataDisk(lun=lun, create_option=DiskCreateOptionTypes.empty, disk_size_gb=size_gb, - caching=caching, managed_disk=ManagedDiskParameters(storage_account_type=sku)) - else: - data_disk = DataDisk(lun=lun, create_option=DiskCreateOptionTypes.attach, caching=caching, - managed_disk=ManagedDiskParameters(id=existing_disk, storage_account_type=sku)) - - data_disks.append(data_disk) - storage_profile.data_disks = data_disks - - DiskCreateOptionTypes, ManagedDiskParameters = cmd.get_models( - 'DiskCreateOptionTypes', 'ManagedDiskParameters') - if disk is None: - DataDisk = cmd.get_models('VirtualMachineScaleSetDataDisk') - else: - DataDisk = cmd.get_models('DataDisk') - - client = _compute_client_factory(cmd.cli_ctx) - if instance_id is None: - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - # Avoid unnecessary permission error - vmss.virtual_machine_profile.storage_profile.image_reference = None - # pylint: disable=no-member - _init_data_disk(vmss.virtual_machine_profile.storage_profile, lun) - return client.virtual_machine_scale_sets.begin_create_or_update(resource_group_name, vmss_name, vmss) - - vmss_vm = client.virtual_machine_scale_set_vms.get(resource_group_name, vmss_name, instance_id) - # Avoid unnecessary permission error - vmss_vm.storage_profile.image_reference = None - _init_data_disk(vmss_vm.storage_profile, lun, disk) - return client.virtual_machine_scale_set_vms.begin_update(resource_group_name, vmss_name, instance_id, vmss_vm) - - -def detach_disk_from_vmss(cmd, resource_group_name, vmss_name, lun, instance_id=None): - client = _compute_client_factory(cmd.cli_ctx) - if instance_id is None: - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - # Avoid unnecessary permission error - vmss.virtual_machine_profile.storage_profile.image_reference = None - # pylint: disable=no-member - data_disks = vmss.virtual_machine_profile.storage_profile.data_disks - else: - vmss_vm = client.virtual_machine_scale_set_vms.get(resource_group_name, vmss_name, instance_id) - # Avoid unnecessary permission error - vmss_vm.storage_profile.image_reference = None - data_disks = vmss_vm.storage_profile.data_disks - - if not data_disks: - raise CLIError("Data disk doesn't exist") - - leftovers = [d for d in data_disks if d.lun != lun] - if len(data_disks) == len(leftovers): - raise CLIError("Could not find the data disk with lun '{}'".format(lun)) - - if instance_id is None: - vmss.virtual_machine_profile.storage_profile.data_disks = leftovers - return client.virtual_machine_scale_sets.begin_create_or_update(resource_group_name, vmss_name, vmss) - vmss_vm.storage_profile.data_disks = leftovers - return client.virtual_machine_scale_set_vms.begin_update(resource_group_name, vmss_name, instance_id, vmss_vm) - - -# endregion - - -# region VirtualMachineScaleSets Extensions -def delete_vmss_extension(cmd, resource_group_name, vmss_name, extension_name): - client = _compute_client_factory(cmd.cli_ctx) - vmss = client.virtual_machine_scale_sets.get(resource_group_name=resource_group_name, vm_scale_set_name=vmss_name) - # Avoid unnecessary permission error - vmss.virtual_machine_profile.storage_profile.image_reference = None - # pylint: disable=no-member - if not vmss.virtual_machine_profile.extension_profile: - raise CLIError('Scale set has no extensions to delete') - - keep_list = [e for e in vmss.virtual_machine_profile.extension_profile.extensions - if e.name != extension_name] - if len(keep_list) == len(vmss.virtual_machine_profile.extension_profile.extensions): - raise CLIError('Extension {} not found'.format(extension_name)) - - vmss.virtual_machine_profile.extension_profile.extensions = keep_list - - return client.virtual_machine_scale_sets.begin_create_or_update(resource_group_name=resource_group_name, - vm_scale_set_name=vmss_name, parameters=vmss) - - -# pylint: disable=inconsistent-return-statements -def get_vmss_extension(cmd, resource_group_name, vmss_name, extension_name): - client = _compute_client_factory(cmd.cli_ctx) - vmss = client.virtual_machine_scale_sets.get(resource_group_name=resource_group_name, vm_scale_set_name=vmss_name) - # pylint: disable=no-member - if not vmss.virtual_machine_profile.extension_profile: - return - return next((e for e in vmss.virtual_machine_profile.extension_profile.extensions - if e.name == extension_name), None) - - -def list_vmss_extensions(cmd, resource_group_name, vmss_name): - client = _compute_client_factory(cmd.cli_ctx) - vmss = client.virtual_machine_scale_sets.get(resource_group_name=resource_group_name, vm_scale_set_name=vmss_name) - # pylint: disable=no-member - if vmss.virtual_machine_profile and vmss.virtual_machine_profile.extension_profile: - return vmss.virtual_machine_profile.extension_profile.extensions - return None - - -def set_vmss_extension(cmd, resource_group_name, vmss_name, extension_name, publisher, version=None, - settings=None, protected_settings=None, no_auto_upgrade=False, force_update=False, - no_wait=False, extension_instance_name=None, provision_after_extensions=None, - enable_auto_upgrade=None): - if not extension_instance_name: - extension_instance_name = extension_name - - auto_upgrade_extensions = ['CodeIntegrityAgent'] - if extension_name in auto_upgrade_extensions and enable_auto_upgrade is None: - enable_auto_upgrade = True - - client = _compute_client_factory(cmd.cli_ctx) - vmss = client.virtual_machine_scale_sets.get(resource_group_name=resource_group_name, vm_scale_set_name=vmss_name) - # Avoid unnecessary permission error - vmss.virtual_machine_profile.storage_profile.image_reference = None - VirtualMachineScaleSetExtension, VirtualMachineScaleSetExtensionProfile = cmd.get_models( - 'VirtualMachineScaleSetExtension', 'VirtualMachineScaleSetExtensionProfile') - - # pylint: disable=no-member - version = _normalize_extension_version(cmd.cli_ctx, publisher, extension_name, version, vmss.location) - extension_profile = vmss.virtual_machine_profile.extension_profile - if extension_profile: - extensions = extension_profile.extensions - if extensions: - extension_profile.extensions = [x for x in extensions if - x.type_properties_type.lower() != extension_name.lower() or x.publisher.lower() != publisher.lower()] # pylint: disable=line-too-long - - if cmd.supported_api_version(min_api='2019-07-01', operation_group='virtual_machine_scale_sets'): - ext = VirtualMachineScaleSetExtension(name=extension_instance_name, - publisher=publisher, - type_properties_type=extension_name, - protected_settings=protected_settings, - type_handler_version=version, - settings=settings, - auto_upgrade_minor_version=(not no_auto_upgrade), - provision_after_extensions=provision_after_extensions, - enable_automatic_upgrade=enable_auto_upgrade) - else: - ext = VirtualMachineScaleSetExtension(name=extension_instance_name, - publisher=publisher, - type=extension_name, - protected_settings=protected_settings, - type_handler_version=version, - settings=settings, - auto_upgrade_minor_version=(not no_auto_upgrade), - provision_after_extensions=provision_after_extensions, - enable_automatic_upgrade=enable_auto_upgrade) - - if force_update: - ext.force_update_tag = str(_gen_guid()) - - if not vmss.virtual_machine_profile.extension_profile: - vmss.virtual_machine_profile.extension_profile = VirtualMachineScaleSetExtensionProfile(extensions=[]) - vmss.virtual_machine_profile.extension_profile.extensions.append(ext) - - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_create_or_update, - resource_group_name, vmss_name, vmss) - - -def set_orchestration_service_state(cmd, resource_group_name, vm_scale_set_name, service_name, action, no_wait=False): - # currently service_name has only one available value "AutomaticRepairs". And SDK does not accept service_name, - # instead SDK assign it to "AutomaticRepairs" in its own logic. As there may be more service name to be supported, - # we define service_name as a required parameter here to avoid introducing a breaking change in the future. - client = _compute_client_factory(cmd.cli_ctx) - OrchestrationServiceStateInput = cmd.get_models('OrchestrationServiceStateInput') - state_input = OrchestrationServiceStateInput(service_name=service_name, action=action) - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_set_orchestration_service_state, - resource_group_name, vm_scale_set_name, state_input) - - -def upgrade_vmss_extension(cmd, resource_group_name, vm_scale_set_name, no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - return sdk_no_wait(no_wait, client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade, - resource_group_name, vm_scale_set_name) - - -# endregion - - -# region VirtualMachineScaleSets RunCommand -def vmss_run_command_invoke(cmd, resource_group_name, vmss_name, command_id, instance_id, scripts=None, - parameters=None): # pylint: disable=line-too-long - return run_command_invoke(cmd, resource_group_name, vmss_name, command_id, scripts, parameters, instance_id) - - -def vmss_run_command_create(client, - resource_group_name, - vmss_name, - instance_id, - run_command_name, - location, - tags=None, - script=None, - script_uri=None, - command_id=None, - parameters=None, - protected_parameters=None, - async_execution=None, - run_as_user=None, - run_as_password=None, - timeout_in_seconds=None, - output_blob_uri=None, - error_blob_uri=None, - no_wait=False): - run_command = {} - run_command['location'] = location - if tags is not None: - run_command['tags'] = tags - source = {} - if script is not None: - source['script'] = script - if script_uri is not None: - source['script_uri'] = script_uri - if command_id is not None: - source['command_id'] = command_id - run_command['source'] = source - if parameters is not None: - auto_arg_name_num = 0 - run_command['parameters'] = [] - for p in parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command['parameters'].append({'name': n, 'value': v}) - if protected_parameters is not None: - auto_arg_name_num = 0 - run_command['protected_parameters'] = [] - for p in protected_parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command['protected_parameters'].append({'name': n, 'value': v}) - if async_execution is not None: - run_command['async_execution'] = async_execution - else: - run_command['async_execution'] = False - if run_as_user is not None: - run_command['run_as_user'] = run_as_user - if run_as_password is not None: - run_command['run_as_password'] = run_as_password - if timeout_in_seconds is not None: - run_command['timeout_in_seconds'] = timeout_in_seconds - if output_blob_uri is not None: - run_command['output_blob_uri'] = output_blob_uri - if error_blob_uri is not None: - run_command['error_blob_uri'] = error_blob_uri - return sdk_no_wait(no_wait, - client.begin_create_or_update, - resource_group_name=resource_group_name, - vm_scale_set_name=vmss_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command) - - -def vmss_run_command_update(client, - resource_group_name, - vmss_name, - instance_id, - run_command_name, - location, - tags=None, - script=None, - script_uri=None, - command_id=None, - parameters=None, - protected_parameters=None, - async_execution=None, - run_as_user=None, - run_as_password=None, - timeout_in_seconds=None, - output_blob_uri=None, - error_blob_uri=None, - no_wait=False): - run_command = {} - run_command['location'] = location - if tags is not None: - run_command['tags'] = tags - source = {} - if script is not None: - source['script'] = script - if script_uri is not None: - source['script_uri'] = script_uri - if command_id is not None: - source['command_id'] = command_id - run_command['source'] = source - if parameters is not None: - auto_arg_name_num = 0 - run_command['parameters'] = [] - for p in parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command['parameters'].append({'name': n, 'value': v}) - if protected_parameters is not None: - auto_arg_name_num = 0 - run_command['protected_parameters'] = [] - for p in protected_parameters: - if '=' in p: - n, v = p.split('=', 1) - else: - auto_arg_name_num += 1 - n = 'arg{}'.format(auto_arg_name_num) - v = p - run_command['protected_parameters'].append({'name': n, 'value': v}) - if async_execution is not None: - run_command['async_execution'] = async_execution - else: - run_command['async_execution'] = False - if run_as_user is not None: - run_command['run_as_user'] = run_as_user - if run_as_password is not None: - run_command['run_as_password'] = run_as_password - if timeout_in_seconds is not None: - run_command['timeout_in_seconds'] = timeout_in_seconds - if output_blob_uri is not None: - run_command['output_blob_uri'] = output_blob_uri - if error_blob_uri is not None: - run_command['error_blob_uri'] = error_blob_uri - return sdk_no_wait(no_wait, - client.begin_update, - resource_group_name=resource_group_name, - vm_scale_set_name=vmss_name, - instance_id=instance_id, - run_command_name=run_command_name, - run_command=run_command) - - -def vmss_run_command_delete(client, - resource_group_name, - vmss_name, - instance_id, - run_command_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - resource_group_name=resource_group_name, - vm_scale_set_name=vmss_name, - instance_id=instance_id, - run_command_name=run_command_name) - - -def vmss_run_command_list(client, - resource_group_name, - vmss_name, - instance_id, - expand=None): - return client.list(resource_group_name=resource_group_name, - vm_scale_set_name=vmss_name, - instance_id=instance_id, - expand=expand) - - -def vmss_run_command_show(client, - resource_group_name, - vmss_name, - instance_id, - run_command_name, - expand=None, - instance_view=False): - if instance_view: - expand = 'instanceView' - return client.get(resource_group_name=resource_group_name, - vm_scale_set_name=vmss_name, - instance_id=instance_id, - run_command_name=run_command_name, - expand=expand) - - -# endregion - - -# region VirtualMachineScaleSets Identity -def remove_vmss_identity(cmd, resource_group_name, vmss_name, identities=None): - client = _compute_client_factory(cmd.cli_ctx) - - def _get_vmss(_, resource_group_name, vmss_name): - return client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - - def _set_vmss(resource_group_name, name, vmss_instance): - VirtualMachineScaleSetUpdate = cmd.get_models('VirtualMachineScaleSetUpdate', - operation_group='virtual_machine_scale_sets') - vmss_update = VirtualMachineScaleSetUpdate(identity=vmss_instance.identity) - return client.virtual_machine_scale_sets.begin_update(resource_group_name, vmss_name, vmss_update) - - if identities is None: - from ._vm_utils import MSI_LOCAL_ID - identities = [MSI_LOCAL_ID] - - return _remove_identities(cmd, resource_group_name, vmss_name, identities, - _get_vmss, - _set_vmss) - - -# endregion - - -def create_gallery_image(cmd, resource_group_name, gallery_name, gallery_image_name, os_type, publisher, offer, sku, - os_state='Generalized', end_of_life_date=None, privacy_statement_uri=None, - release_note_uri=None, eula=None, description=None, location=None, - minimum_cpu_core=None, maximum_cpu_core=None, minimum_memory=None, maximum_memory=None, - disallowed_disk_types=None, plan_name=None, plan_publisher=None, plan_product=None, tags=None, - hyper_v_generation='V2', features=None, architecture=None): - logger.warning( - "Starting Build (May) 2024, \"az sig image-definition create\" command will use the new default values " - "Hyper-V Generation: V2 and SecurityType: TrustedLaunchSupported." - ) - - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - - end_of_life_date = fix_gallery_image_date_info(end_of_life_date) - recommendation = None - if any([minimum_cpu_core, maximum_cpu_core, minimum_memory, maximum_memory]): - cpu_recommendation, memory_recommendation = None, None - if any([minimum_cpu_core, maximum_cpu_core]): - cpu_recommendation = { - "min": minimum_cpu_core, - "max": maximum_cpu_core, - } - if any([minimum_memory, maximum_memory]): - memory_recommendation = { - "min": minimum_memory, - "max": maximum_memory, - } - - recommendation = { - "v_cp_us": cpu_recommendation, - "memory": memory_recommendation - } - purchase_plan = None - if any([plan_name, plan_publisher, plan_product]): - purchase_plan = { - "name": plan_name, - "publisher": plan_publisher, - "product": plan_product, - } - - feature_list = None - if features: - from ._constants import COMPATIBLE_SECURITY_TYPE_VALUE, UPGRADE_SECURITY_HINT - feature_list = [] - security_type = None - for item in features.split(): - try: - key, value = item.split('=', 1) - # create Non-Trusted Launch VM Image - # The `Standard` is used for backward compatibility to allow customers to keep their current behavior - # after changing the default values to Trusted Launch VMs in the future. - if key == 'SecurityType': - security_type = True - if key == 'SecurityType' and value == COMPATIBLE_SECURITY_TYPE_VALUE: - logger.warning(UPGRADE_SECURITY_HINT) - continue - feature_list.append({ - "name": key, - "value": value, - }) - except ValueError: - raise CLIError('usage error: --features KEY=VALUE [KEY=VALUE ...]') - if security_type is None and hyper_v_generation == 'V2': - feature_list.append({ - "name": "SecurityType", - "value": "TrustedLaunchSupported", - }) - if features is None and cmd.cli_ctx.cloud.profile == 'latest' and hyper_v_generation == 'V2': - feature_list = [{ - "name": "SecurityType", - "value": "TrustedLaunchSupported", - }] - - args = { - "identifier": {"publisher": publisher, "offer": offer, "sku": sku}, - "os_type": os_type, - "os_state": os_state, - "end_of_life_date": end_of_life_date, - "recommended": recommendation, - "disallowed": {"disk_types": disallowed_disk_types}, - "purchase_plan": purchase_plan, - "location": location, - "eula": eula, - "tags": tags or {}, - "hyper_v_generation": hyper_v_generation, - "features": feature_list, - "architecture": architecture, - "resource_group": resource_group_name, - "gallery_name": gallery_name, - "gallery_image_name": gallery_image_name, - } - - _SigImageDefinition = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "sig.image_definition") - return _SigImageDefinition.Create(cli_ctx=cmd.cli_ctx)(command_args=args) - - -def _add_aux_subscription(aux_subscriptions, resource_id): - if resource_id: - aux_subs = _parse_aux_subscriptions(resource_id) - if aux_subs and aux_subs[0] not in aux_subscriptions: - aux_subscriptions.extend(aux_subs) - - -def _get_image_version_aux_subscription(managed_image, os_snapshot, data_snapshots): - aux_subscriptions = [] - _add_aux_subscription(aux_subscriptions, managed_image) - _add_aux_subscription(aux_subscriptions, os_snapshot) - if data_snapshots: - for data_snapshot in data_snapshots: - _add_aux_subscription(aux_subscriptions, data_snapshot) - return aux_subscriptions if aux_subscriptions else None - - -def create_image_version(cmd, resource_group_name, gallery_name, gallery_image_name, gallery_image_version, - location=None, target_regions=None, storage_account_type=None, - end_of_life_date=None, exclude_from_latest=None, replica_count=None, tags=None, - os_snapshot=None, data_snapshots=None, managed_image=None, data_snapshot_luns=None, - target_region_encryption=None, os_vhd_uri=None, os_vhd_storage_account=None, - data_vhds_uris=None, data_vhds_luns=None, data_vhds_storage_accounts=None, - replication_mode=None, target_region_cvm_encryption=None, virtual_machine=None, - image_version=None, target_zone_encryption=None, target_edge_zones=None, - allow_replicated_location_deletion=None): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - end_of_life_date = fix_gallery_image_date_info(end_of_life_date) - if managed_image and not is_valid_resource_id(managed_image): - managed_image = resource_id(subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='images', name=managed_image) - if os_snapshot and not is_valid_resource_id(os_snapshot): - os_snapshot = resource_id(subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='snapshots', name=os_snapshot) - if data_snapshots: - for i, s in enumerate(data_snapshots): - if not is_valid_resource_id(data_snapshots[i]): - data_snapshots[i] = resource_id( - subscription=get_subscription_id(cmd.cli_ctx), resource_group=resource_group_name, - namespace='Microsoft.Compute', type='snapshots', name=s) - - profile = { - "exclude_from_latest": exclude_from_latest, - "end_of_life_date": end_of_life_date, - "target_regions": target_regions or [{"name": location}], - "replica_count": replica_count, - "storage_account_type": storage_account_type - } - - if target_edge_zones: - profile["target_extended_locations"] = target_edge_zones - - if replication_mode is not None: - profile["replication_mode"] = replication_mode - if not cmd.supported_api_version(min_api='2022-03-03', operation_group='gallery_image_versions'): - source = {"managed_image": {"id": managed_image}} - profile["source"] = source - - if managed_image is None and os_snapshot is None and os_vhd_uri is None: - raise RequiredArgumentMissingError('usage error: Please provide --managed-image or --os-snapshot or --vhd') - - source = os_disk_image = data_disk_images = None - if managed_image is not None: - source = {"id": managed_image} - if os_snapshot is not None: - os_disk_image = {"source": {"id": os_snapshot}} - if data_snapshot_luns and not data_snapshots: - raise ArgumentUsageError('usage error: --data-snapshot-luns must be used together with --data-snapshots') - if data_snapshots: - if data_snapshot_luns and len(data_snapshots) != len(data_snapshot_luns): - raise ArgumentUsageError('usage error: Length of --data-snapshots and ' - '--data-snapshot-luns should be equal.') - if not data_snapshot_luns: - data_snapshot_luns = list(range(len(data_snapshots))) - data_disk_images = [] - for i, s in enumerate(data_snapshots): - data_disk_images.append({"source": {"id": s}, "lun": int(data_snapshot_luns[i])}) - - storage_profile = {"source": source, "os_disk_image": os_disk_image, "data_disk_images": data_disk_images} - args = { - "publishing_profile": profile, - "location": location, - "tags": tags or {}, - "storage_profile": storage_profile - } - if allow_replicated_location_deletion is not None: - args["safety_profile"] = { - "allow_deletion_of_replicated_locations": allow_replicated_location_deletion - } - - args["resource_group"] = resource_group_name - args["gallery_name"] = gallery_name - args["gallery_image_definition"] = gallery_image_name - args["gallery_image_version_name"] = gallery_image_version - - _SigImageVersion = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "sig.image_version") - return _SigImageVersion.Create(cli_ctx=cmd.cli_ctx)(command_args=args) - - -def undelete_image_version(cmd, resource_group_name, gallery_name, gallery_image_name, gallery_image_version, - location=None, tags=None, allow_replicated_location_deletion=None): - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - - _Sig = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "sig") - gallery = _Sig.Show(cli_ctx=cmd.cli_ctx)(command_args={ - "resource_group": resource_group_name, - "gallery_name": gallery_name - }) - - if gallery.get("softDeletePolicy", None) and gallery["softDeletePolicy"].get("isSoftDeleteEnabled", None): - soft_delete = gallery["softDeletePolicy"]["isSoftDeleteEnabled"] - else: - soft_delete = None - - if not soft_delete: - from azure.cli.core.azclierror import InvalidArgumentValueError - raise InvalidArgumentValueError('soft-deletion is not enabled in Gallery \'{}\''.format(gallery_name)) - - args = { - "publishing_profile": None, - "location": location, - "tags": tags or {}, - "storage_profile": None, - } - if allow_replicated_location_deletion is not None: - args["safety_profile"] = { - "allow_deletion_of_replicated_locations": allow_replicated_location_deletion - } - - args["resource_group"] = resource_group_name - args["gallery_name"] = gallery_name - args["gallery_image_definition"] = gallery_image_name - args["gallery_image_version_name"] = gallery_image_version - - _SigImageVersion = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "sig.image_version") - return _SigImageVersion.Create(cli_ctx=cmd.cli_ctx)(command_args=args) - - -def fix_gallery_image_date_info(date_info): - # here we add needed time, if only date is provided, so the setting can be accepted by servie end - if date_info and 't' not in date_info.lower(): - date_info += 'T12:59:59Z' - return date_info - - -# pylint: disable=line-too-long -def get_image_version_to_update(cmd, resource_group_name, gallery_name, gallery_image_name, gallery_image_version_name): - _SigImageVersion = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "sig.image_version") - version = _SigImageVersion.Show(cli_ctx=cmd.cli_ctx)(command_args={ - "resource_group": resource_group_name, - "gallery_name": gallery_name, - "gallery_image_definition": gallery_image_name, - "gallery_image_version_name": gallery_image_version_name, - }) - - # To avoid unnecessary permission check of image - if "storage_profile" not in version: - version["storage_profile"] = {} - version["storage_profile"]["source"] = None - if version["storage_profile"].get("os_disk_image", None) and \ - version["storage_profile"]["os_disk_image"].get("source", None): - version["storage_profile"]["os_disk_image"]["source"] = None - if version["storage_profile"].get("data_disk_images", None): - for v in version["storage_profile"]["data_disk_images"]: - if v.get("source", None): - v["source"] = None - return version - - -def update_image_version(cmd, resource_group_name, gallery_name, gallery_image_name, gallery_image_version_name, - target_regions=None, replica_count=None, allow_replicated_location_deletion=None, - target_edge_zones=None, no_wait=False, **kwargs): - args = kwargs['gallery_image_version'] - - if target_regions: - if "publishing_profile" not in args: - args["publishing_profile"] = {} - args["publishing_profile"]["target_regions"] = target_regions - if replica_count: - if "publishing_profile" not in args: - args["publishing_profile"] = {} - args["publishing_profile"]["replica_count"] = replica_count - if args.get("storage_profile", None) and args["storage_profile"].get("source", None) is not None: - args["storage_profile"]["os_disk_image"] = args["storage_profile"]["data_disk_images"] = None - # target extended locations will be updated when --target-edge-zones is specified - if target_edge_zones is not None: - if "publishing_profile" not in args: - args["publishing_profile"] = {} - args["publishing_profile"]["target_extended_locations"] = target_edge_zones \ - if len(target_edge_zones) > 0 else None - if allow_replicated_location_deletion is not None: - if "safety_profile" not in args: - args["safety_profile"] = {} - args["safety_profile"]["allow_deletion_of_replicated_locations"] = allow_replicated_location_deletion - - args["resource_group"] = resource_group_name - args["gallery_name"] = gallery_name - args["gallery_image_definition"] = gallery_image_name - args["gallery_image_version_name"] = gallery_image_version_name - - _SigImageVersion = import_aaz_by_profile(cmd.cli_ctx.cloud.profile, "sig.image_version") - return _SigImageVersion.Update(cli_ctx=cmd.cli_ctx)(command_args=args) -# endregion - - -# region dedicated host -def create_dedicated_host_group(cmd, client, host_group_name, resource_group_name, platform_fault_domain_count, - automatic_placement=None, location=None, zones=None, tags=None, ultra_ssd_enabled=None): - DedicatedHostGroup = cmd.get_models('DedicatedHostGroup') - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - - host_group_params = DedicatedHostGroup(location=location, platform_fault_domain_count=platform_fault_domain_count, - support_automatic_placement=automatic_placement, zones=zones, tags=tags) - if ultra_ssd_enabled is not None: - additionalCapabilities = {'ultraSSDEnabled': ultra_ssd_enabled} - host_group_params.additional_capabilities = additionalCapabilities - - return client.create_or_update(resource_group_name, host_group_name, parameters=host_group_params) - - -def get_dedicated_host_group_instance_view(client, host_group_name, resource_group_name): - return client.get(resource_group_name, host_group_name, expand="instanceView") - - -def create_dedicated_host(cmd, client, host_group_name, host_name, resource_group_name, sku, platform_fault_domain=None, - auto_replace_on_failure=None, license_type=None, location=None, tags=None): - DedicatedHostType = cmd.get_models('DedicatedHost') - SkuType = cmd.get_models('Sku') - - location = location or _get_resource_group_location(cmd.cli_ctx, resource_group_name) - sku = SkuType(name=sku) - - host_params = DedicatedHostType(location=location, platform_fault_domain=platform_fault_domain, - auto_replace_on_failure=auto_replace_on_failure, license_type=license_type, - sku=sku, tags=tags) - - return client.begin_create_or_update(resource_group_name, host_group_name, host_name, parameters=host_params) - - -def get_dedicated_host_instance_view(client, host_group_name, host_name, resource_group_name): - return client.get(resource_group_name, host_group_name, host_name, expand="instanceView") - - -# endregion - - -# region VMMonitor -def _get_log_analytics_client(cmd): - from ._client_factory import cf_log_analytics - from azure.cli.core.commands.client_factory import get_subscription_id - subscription_id = get_subscription_id(cmd.cli_ctx) - return cf_log_analytics(cmd.cli_ctx, subscription_id) - - -def _prepare_workspace(cmd, resource_group_name, workspace): - from azure.mgmt.core.tools import is_valid_resource_id - - from azure.core.exceptions import HttpResponseError - - workspace_id = None - if not is_valid_resource_id(workspace): - workspace_name = workspace - log_client = _get_log_analytics_client(cmd) - workspace_result = None - try: - workspace_result = log_client.workspaces.get(resource_group_name, workspace_name) - except HttpResponseError: - from azure.mgmt.loganalytics.models import Workspace, WorkspaceSku, WorkspaceSkuNameEnum - sku = WorkspaceSku(name=WorkspaceSkuNameEnum.per_gb2018.value) - retention_time = 30 # default value - location = _get_resource_group_location(cmd.cli_ctx, resource_group_name) - workspace_instance = Workspace(location=location, - sku=sku, - retention_in_days=retention_time) - workspace_result = LongRunningOperation(cmd.cli_ctx)(log_client.workspaces.begin_create_or_update( - resource_group_name, - workspace_name, - workspace_instance)) - workspace_id = workspace_result.id - else: - workspace_id = workspace - return workspace_id - - -def _set_data_source_for_workspace(cmd, os_type, resource_group_name, workspace_name): - from ._client_factory import cf_log_analytics_data_sources - from azure.cli.core.commands.client_factory import get_subscription_id - from azure.mgmt.loganalytics.models import DataSource - from azure.core.exceptions import HttpResponseError - - subscription_id = get_subscription_id(cmd.cli_ctx) - data_sources_client = cf_log_analytics_data_sources(cmd.cli_ctx, subscription_id) - data_source_name_template = "DataSource_{}_{}" - - default_data_sources = None - if os_type.lower() == 'linux': - from .._workspace_data_source_settings import default_linux_data_sources - default_data_sources = default_linux_data_sources - elif os_type.lower() == 'windows': - from .._workspace_data_source_settings import default_windows_data_sources - default_data_sources = default_windows_data_sources - - if default_data_sources is not None: - for data_source_kind, data_source_settings in default_data_sources.items(): - for data_source_setting in data_source_settings: - data_source = DataSource(kind=data_source_kind, - properties=data_source_setting) - data_source_name = data_source_name_template.format(data_source_kind, _gen_guid()) - try: - data_sources_client.create_or_update(resource_group_name, - workspace_name, - data_source_name, - data_source) - except HttpResponseError as ex: - logger.warning("Failed to set data source due to %s. " - "Skip this step and need manual work later.", ex.message) - else: - logger.warning("Unsupported OS type. Skip the default settings for log analytics workspace.") - - -def execute_query_for_vm(cmd, client, resource_group_name, vm_name, analytics_query, timespan=None): - """Executes a query against the Log Analytics workspace linked with a vm.""" - vm = get_vm(cmd, resource_group_name, vm_name) - workspace = None - extension_resources = vm.resources or [] - for resource in extension_resources: - if resource.name == "MicrosoftMonitoringAgent" or resource.name == "OmsAgentForLinux": - workspace = resource.settings.get('workspaceId', None) - if workspace is None: - raise CLIError('Cannot find the corresponding log analytics workspace. ' - 'Please check the status of log analytics workpsace.') - return client.query_workspace(workspace, analytics_query, timespan=timespan) - - -def _set_log_analytics_workspace_extension(cmd, resource_group_name, vm, vm_name, workspace_name): - is_linux_os = _is_linux_os(vm) - vm_extension_name = _LINUX_OMS_AGENT_EXT if is_linux_os else _WINDOWS_OMS_AGENT_EXT - log_client = _get_log_analytics_client(cmd) - customer_id = log_client.workspaces.get(resource_group_name, workspace_name).customer_id - settings = { - 'workspaceId': customer_id, - 'stopOnMultipleConnections': 'true' - } - primary_shared_key = log_client.shared_keys.get_shared_keys(resource_group_name, workspace_name).primary_shared_key - protected_settings = { - 'workspaceKey': primary_shared_key, - } - return set_extension(cmd, resource_group_name, vm_name, vm_extension_name, - extension_mappings[vm_extension_name]['publisher'], - extension_mappings[vm_extension_name]['version'], - settings, - protected_settings) - - -# endregion - - -# disk encryption set -def create_disk_encryption_set( - cmd, client, resource_group_name, disk_encryption_set_name, key_url, source_vault=None, encryption_type=None, - location=None, tags=None, no_wait=False, enable_auto_key_rotation=None, federated_client_id=None, - mi_system_assigned=None, mi_user_assigned=None): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - DiskEncryptionSet, EncryptionSetIdentity, KeyForDiskEncryptionSet, SourceVault = cmd.get_models( - 'DiskEncryptionSet', 'EncryptionSetIdentity', 'KeyForDiskEncryptionSet', 'SourceVault') - - identity_type, user_assigned_identities = \ - _build_identities_info_from_system_user_assigned(cmd, mi_system_assigned, mi_user_assigned) - - encryption_set_identity = EncryptionSetIdentity(type=identity_type) - if user_assigned_identities is not None: - encryption_set_identity.user_assigned_identities = user_assigned_identities - - if source_vault is not None: - if not is_valid_resource_id(source_vault): - source_vault = resource_id(subscription=get_subscription_id(cmd.cli_ctx), - resource_group=resource_group_name, - namespace='Microsoft.KeyVault', type='vaults', name=source_vault) - source_vault = SourceVault(id=source_vault) - - key_for_disk_emcryption_set = KeyForDiskEncryptionSet(source_vault=source_vault, key_url=key_url) - disk_encryption_set = DiskEncryptionSet(location=location, tags=tags, identity=encryption_set_identity, - active_key=key_for_disk_emcryption_set, encryption_type=encryption_type, - rotation_to_latest_key_version_enabled=enable_auto_key_rotation) - - if federated_client_id is not None: - disk_encryption_set.federated_client_id = federated_client_id - - return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, disk_encryption_set_name, - disk_encryption_set) - - -def update_disk_encryption_set(cmd, instance, client, resource_group_name, key_url=None, source_vault=None, - enable_auto_key_rotation=None, federated_client_id=None): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - if key_url: - instance.active_key.key_url = key_url - - if source_vault: - if not is_valid_resource_id(source_vault): - source_vault = resource_id(subscription=get_subscription_id(cmd.cli_ctx), - resource_group=resource_group_name, - namespace='Microsoft.KeyVault', type='vaults', name=source_vault) - instance.active_key.source_vault = {'id': source_vault} - - if enable_auto_key_rotation is not None: - instance.rotation_to_latest_key_version_enabled = enable_auto_key_rotation - - if federated_client_id is not None: - instance.federated_client_id = federated_client_id - - return instance - - -def assign_disk_encryption_set_identity(cmd, client, resource_group_name, disk_encryption_set_name, - mi_system_assigned=None, mi_user_assigned=None): - DiskEncryptionSetUpdate, EncryptionSetIdentity = cmd.get_models('DiskEncryptionSetUpdate', 'EncryptionSetIdentity', - operation_group='disk_encryption_sets') - from azure.cli.core.commands.arm import assign_identity as assign_identity_helper - client = _compute_client_factory(cmd.cli_ctx) - - def getter(): - return client.disk_encryption_sets.get(resource_group_name, disk_encryption_set_name) - - def setter(disk_encryption_set, mi_system_assigned=mi_system_assigned, mi_user_assigned=mi_user_assigned): - IdentityType = cmd.get_models('DiskEncryptionSetIdentityType', operation_group='disk_encryption_sets') - existing_system_identity = False - existing_user_identities = set() - if disk_encryption_set.identity is not None: - existing_system_identity = disk_encryption_set.identity.type in [IdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, - IdentityType.SYSTEM_ASSIGNED] - existing_user_identities = {x.lower() for x in - list((disk_encryption_set.identity.user_assigned_identities or {}).keys())} - - add_system_assigned = mi_system_assigned - add_user_assigned = {x.lower() for x in (mi_user_assigned or [])} - - updated_system_assigned = existing_system_identity or add_system_assigned - updated_user_assigned = list(existing_user_identities.union(add_user_assigned)) - - identity_types, user_assigned_identities = _build_identities_info_from_system_user_assigned( - cmd, updated_system_assigned, updated_user_assigned) - - encryption_set_identity = EncryptionSetIdentity(type=identity_types, - user_assigned_identities=user_assigned_identities) - - disk_encryption_set_update = DiskEncryptionSetUpdate() - disk_encryption_set_update.identity = encryption_set_identity - return patch_disk_encryption_set(cmd, resource_group_name, disk_encryption_set_name, disk_encryption_set_update) - - disk_encryption_set = assign_identity_helper(cmd.cli_ctx, getter, setter) - return disk_encryption_set.identity - - -def remove_disk_encryption_set_identity(cmd, client, resource_group_name, disk_encryption_set_name, - mi_system_assigned=None, mi_user_assigned=None): - DiskEncryptionSetUpdate = cmd.get_models('DiskEncryptionSetUpdate', operation_group='disk_encryption_sets') - client = _compute_client_factory(cmd.cli_ctx) - - def getter(cmd, resource_group_name, disk_encryption_set_name): - return client.disk_encryption_sets.get(resource_group_name, disk_encryption_set_name) - - def setter(resource_group_name, disk_encryption_set_name, disk_encryption_set): - disk_encryption_set_update = DiskEncryptionSetUpdate(identity=disk_encryption_set.identity) - return client.disk_encryption_sets.begin_update(resource_group_name, disk_encryption_set_name, - disk_encryption_set_update) - - return _remove_disk_encryption_set_identities(cmd, resource_group_name, disk_encryption_set_name, - mi_system_assigned, mi_user_assigned, getter, setter) - - -def show_disk_encryption_set_identity(cmd, resource_group_name, disk_encryption_set_name): - client = _compute_client_factory(cmd.cli_ctx) - return client.disk_encryption_sets.get(resource_group_name, disk_encryption_set_name).identity -# endregion - - -# region install patches -def install_vm_patches(cmd, client, resource_group_name, vm_name, maximum_duration, reboot_setting, - classifications_to_include_win=None, classifications_to_include_linux=None, - kb_numbers_to_include=None, kb_numbers_to_exclude=None, - exclude_kbs_requiring_reboot=None, package_name_masks_to_include=None, - package_name_masks_to_exclude=None, max_patch_publish_date=None, no_wait=False): - VMInstallPatchesParameters, WindowsParameters, LinuxParameters = cmd.get_models( - 'VirtualMachineInstallPatchesParameters', 'WindowsParameters', 'LinuxParameters') - windows_parameters = WindowsParameters(classifications_to_include=classifications_to_include_win, - kb_numbers_to_inclunde=kb_numbers_to_include, - kb_numbers_to_exclude=kb_numbers_to_exclude, - exclude_kbs_requirig_reboot=exclude_kbs_requiring_reboot, - max_patch_publish_date=max_patch_publish_date) - linux_parameters = LinuxParameters(classifications_to_include=classifications_to_include_linux, - package_name_masks_to_include=package_name_masks_to_include, - package_name_masks_to_exclude=package_name_masks_to_exclude) - install_patches_input = VMInstallPatchesParameters(maximum_duration=maximum_duration, reboot_setting=reboot_setting, - linux_parameters=linux_parameters, - windows_parameters=windows_parameters) - - return sdk_no_wait(no_wait, client.begin_install_patches, resource_group_name=resource_group_name, vm_name=vm_name, - install_patches_input=install_patches_input) - - -# endregion - - -def get_page_result(generator, marker, show_next_marker=None): - pages = generator.by_page(continuation_token=marker) # ContainerPropertiesPaged - result = list_generator(pages=pages) - - if show_next_marker: - next_marker = {"nextMarker": pages.continuation_token} - result.append(next_marker) - else: - if pages.continuation_token: - logger.warning('Next Marker:') - logger.warning(pages.continuation_token) - - return result - - -def list_generator(pages, num_results=50): - result = [] - - # get first page items - page = list(next(pages)) - result += page - - while True: - if not pages.continuation_token: - break - - # handle num results - if num_results is not None: - if num_results <= len(result): - break - - page = list(next(pages)) - result += page - - return result - - -def sig_shared_image_definition_list(client, location, gallery_unique_name, - shared_to=None, marker=None, show_next_marker=None): - # Keep it here as it will add subscription in the future and we need to set it to None to make it work - if shared_to == 'subscription': - shared_to = None - generator = client.list(location=location, gallery_unique_name=gallery_unique_name, shared_to=shared_to) - return get_page_result(generator, marker, show_next_marker) - - -def sig_shared_image_version_list(client, location, gallery_unique_name, gallery_image_name, - shared_to=None, marker=None, show_next_marker=None): - # Keep it here as it will add subscription in the future and we need to set it to None to make it work - if shared_to == 'subscription': - shared_to = None - generator = client.list(location=location, gallery_unique_name=gallery_unique_name, - gallery_image_name=gallery_image_name, shared_to=shared_to) - return get_page_result(generator, marker, show_next_marker) - - -def create_capacity_reservation_group(cmd, client, resource_group_name, capacity_reservation_group_name, location=None, - tags=None, zones=None, sharing_profile=None): - CapacityReservationGroup = cmd.get_models('CapacityReservationGroup') - if sharing_profile is not None: - subscription_ids = [{'id': sub_id} for sub_id in sharing_profile] - sharing_profile = {'subscriptionIds': subscription_ids} - capacity_reservation_group = CapacityReservationGroup(location=location, tags=tags, - zones=zones, sharing_profile=sharing_profile) - return client.create_or_update(resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - parameters=capacity_reservation_group) - - -def update_capacity_reservation_group(cmd, client, resource_group_name, capacity_reservation_group_name, tags=None, - sharing_profile=None): - CapacityReservationGroupUpdate = cmd.get_models('CapacityReservationGroupUpdate') - if sharing_profile is not None: - subscription_ids = [{'id': sub_id} for sub_id in sharing_profile] - sharing_profile = {'subscriptionIds': subscription_ids} - capacity_reservation_group = CapacityReservationGroupUpdate(tags=tags, sharing_profile=sharing_profile) - return client.update(resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - parameters=capacity_reservation_group) - - -def show_capacity_reservation_group(client, resource_group_name, capacity_reservation_group_name, - instance_view=None): - expand = None - if instance_view: - expand = 'instanceView' - return client.get(resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - expand=expand) - - -def create_capacity_reservation(cmd, client, resource_group_name, capacity_reservation_group_name, - capacity_reservation_name, location=None, sku_name=None, capacity=None, - zone=None, tags=None): - Sku = cmd.get_models('Sku') - sku = Sku(name=sku_name, capacity=capacity) - CapacityReservation = cmd.get_models('CapacityReservation') - capacity_reservation = CapacityReservation(location=location, sku=sku, zones=zone, tags=tags) - return client.begin_create_or_update(resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - parameters=capacity_reservation) - - -def update_capacity_reservation(cmd, client, resource_group_name, capacity_reservation_group_name, - capacity_reservation_name, capacity=None, tags=None): - Sku = cmd.get_models('Sku') - sku = Sku(capacity=capacity) - - # If only the data of SKU capacity is updated, the original tags will be cleared. - # Therefore, before the service fixes this issue, we add this temporary logic - if tags is None: - capacity_reservation = client.get(resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name) - tags = capacity_reservation.tags - - CapacityReservationUpdate = cmd.get_models('CapacityReservationUpdate') - capacity_reservation_update = CapacityReservationUpdate(sku=sku, tags=tags) - return client.begin_update(resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, - parameters=capacity_reservation_update) - - -def show_capacity_reservation(client, resource_group_name, capacity_reservation_group_name, capacity_reservation_name, - instance_view=None): - expand = None - if instance_view: - expand = 'instanceView' - return client.get(resource_group_name=resource_group_name, - capacity_reservation_group_name=capacity_reservation_group_name, - capacity_reservation_name=capacity_reservation_name, expand=expand) - - -def set_vm_applications(cmd, vm_name, resource_group_name, application_version_ids, order_applications=False, - application_configuration_overrides=None, treat_deployment_as_failure=None, no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - ApplicationProfile, VMGalleryApplication = cmd.get_models('ApplicationProfile', 'VMGalleryApplication') - try: - vm = client.virtual_machines.get(resource_group_name, vm_name) - except ResourceNotFoundError: - raise ResourceNotFoundError('Could not find vm {}.'.format(vm_name)) - - vm.application_profile = ApplicationProfile( - gallery_applications=[VMGalleryApplication(package_reference_id=avid) for avid in application_version_ids]) - - if order_applications: - index = 1 - for app in vm.application_profile.gallery_applications: - app.order = index - index += 1 - - if application_configuration_overrides: - index = 0 - for over_ride in application_configuration_overrides: - if over_ride or over_ride.lower() != 'null': - vm.application_profile.gallery_applications[index].configuration_reference = over_ride - index += 1 - - if treat_deployment_as_failure: - index = 0 - for treat_as_failure in treat_deployment_as_failure: - vm.application_profile.gallery_applications[index].treat_failure_as_deployment_failure = \ - treat_as_failure.lower() == 'true' - index += 1 - return sdk_no_wait(no_wait, client.virtual_machines.begin_create_or_update, resource_group_name, vm_name, vm) - - -def list_vm_applications(cmd, vm_name, resource_group_name): - client = _compute_client_factory(cmd.cli_ctx) - try: - vm = client.virtual_machines.get(resource_group_name, vm_name) - except ResourceNotFoundError: - raise ResourceNotFoundError('Could not find vm {}.'.format(vm_name)) - return vm.application_profile - - -def set_vmss_applications(cmd, vmss_name, resource_group_name, application_version_ids, order_applications=False, - application_configuration_overrides=None, treat_deployment_as_failure=None, no_wait=False): - client = _compute_client_factory(cmd.cli_ctx) - ApplicationProfile, VMGalleryApplication = cmd.get_models('ApplicationProfile', 'VMGalleryApplication') - try: - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - except ResourceNotFoundError: - raise ResourceNotFoundError('Could not find vmss {}.'.format(vmss_name)) - - vmss.virtual_machine_profile.application_profile = ApplicationProfile( - gallery_applications=[VMGalleryApplication(package_reference_id=avid) for avid in application_version_ids]) - - if order_applications: - index = 1 - for app in vmss.virtual_machine_profile.application_profile.gallery_applications: - app.order = index - index += 1 - - if application_configuration_overrides: - index = 0 - for over_ride in application_configuration_overrides: - if over_ride or over_ride.lower() != 'null': - vmss.virtual_machine_profile.application_profile.gallery_applications[ - index].configuration_reference = over_ride - index += 1 - - if treat_deployment_as_failure: - index = 0 - for treat_as_failure in treat_deployment_as_failure: - vmss.virtual_machine_profile.application_profile.gallery_applications[ - index].treat_failure_as_deployment_failure = treat_as_failure.lower() == 'true' - index += 1 - return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_create_or_update, resource_group_name, - vmss_name, vmss) - - -def list_vmss_applications(cmd, vmss_name, resource_group_name): - client = _compute_client_factory(cmd.cli_ctx) - try: - vmss = client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - except ResourceNotFoundError: - raise ResourceNotFoundError('Could not find vmss {}.'.format(vmss_name)) - return vmss.virtual_machine_profile.application_profile - - -# region Restore point collection -def restore_point_create(client, - resource_group_name, - restore_point_collection_name, - restore_point_name, - exclude_disks=None, - source_restore_point=None, - consistency_mode=None, - source_os_resource=None, - os_restore_point_encryption_set=None, - os_restore_point_encryption_type=None, - source_data_disk_resource=None, - data_disk_restore_point_encryption_set=None, - data_disk_restore_point_encryption_type=None, - no_wait=False): - parameters = {} - if exclude_disks is not None: - parameters['excludeDisks'] = [] - for disk in exclude_disks: - parameters['excludeDisks'].append({'id': disk}) - if source_restore_point is not None: - parameters['sourceRestorePoint'] = {'id': source_restore_point} - if consistency_mode is not None: - parameters['consistencyMode'] = consistency_mode - - storage_profile = {} - # Local restore point - if source_restore_point is None: - os_disk = {} - if source_os_resource is not None: - managed_disk = { - 'id': source_os_resource - } - os_disk['managedDisk'] = managed_disk - if os_restore_point_encryption_set is None and os_restore_point_encryption_type is None: - raise ArgumentUsageError( - 'usage error: --os-restore-point-encryption-set or --os-restore-point-encryption-type must be used together with --source-os-resource') - - disk_restore_point = {} - if os_restore_point_encryption_set is not None or os_restore_point_encryption_type is not None: - encryption = {} - if os_restore_point_encryption_set is not None: - encryption['diskEncryptionSet'] = { - 'id': os_restore_point_encryption_set - } - if os_restore_point_encryption_type is not None: - encryption['type'] = os_restore_point_encryption_type - - if encryption: - disk_restore_point['encryption'] = encryption - - if disk_restore_point: - os_disk['diskRestorePoint'] = disk_restore_point - - if os_disk: - storage_profile['osDisk'] = os_disk - - data_disks = [] - if source_data_disk_resource is not None: - if data_disk_restore_point_encryption_set is None and data_disk_restore_point_encryption_type is None: - raise ArgumentUsageError( - 'usage error: --data-disk-restore-point-encryption-set or --data-disk-restore-point-encryption-type must be used together with --source-data-disk-resource') - if data_disk_restore_point_encryption_set is not None and ( - len(source_data_disk_resource) != len(data_disk_restore_point_encryption_set)): - raise ArgumentUsageError( - 'Length of --source-data-disk-resource, --data-disk-restore-point-encryption-set must be same.') - if data_disk_restore_point_encryption_type is not None and ( - len(source_data_disk_resource) != len(data_disk_restore_point_encryption_type)): - raise ArgumentUsageError( - 'Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.') - - for i, v in enumerate(source_data_disk_resource): - data_disks.append({ - 'managedDisk': { - 'id': v - }, - 'diskRestorePoint': { - 'encryption': { - 'disk_encryption_set': { - 'id': data_disk_restore_point_encryption_set[ - i] if data_disk_restore_point_encryption_set is not None else None - }, - 'type': data_disk_restore_point_encryption_type[ - i] if data_disk_restore_point_encryption_type is not None else None - } - } - }) - - if data_disks: - storage_profile['dataDisks'] = data_disks - - # Remote restore point - if source_restore_point is not None: - os_disk = {} - disk_restore_point = {} - if source_os_resource is not None: - source_disk_restore_point = { - 'id': source_os_resource - } - disk_restore_point['sourceDiskRestorePoint'] = source_disk_restore_point - if os_restore_point_encryption_set is None and os_restore_point_encryption_type is None: - raise ArgumentUsageError( - 'usage error: --os-restore-point-encryption-set or --os-restore-point-encryption-type must be used together with --source-os-resource') - - if os_restore_point_encryption_set is not None or os_restore_point_encryption_type is not None: - encryption = {} - if os_restore_point_encryption_set is not None: - encryption['diskEncryptionSet'] = { - 'id': os_restore_point_encryption_set - } - if os_restore_point_encryption_type is not None: - encryption['type'] = os_restore_point_encryption_type - - if encryption: - disk_restore_point['encryption'] = encryption - if disk_restore_point: - os_disk['diskRestorePoint'] = disk_restore_point - if os_disk: - storage_profile['osDisk'] = os_disk - - data_disks = [] - if source_data_disk_resource is not None: - if data_disk_restore_point_encryption_set is None and data_disk_restore_point_encryption_type is None: - raise ArgumentUsageError( - 'usage error: --data-disk-restore-point-encryption-set or --data-disk-restore-point-encryption-type must be used together with --source-data-disk-resource') - if data_disk_restore_point_encryption_set is not None and ( - len(source_data_disk_resource) != len(data_disk_restore_point_encryption_set)): - raise ArgumentUsageError( - 'Length of --source-data-disk-resource, --data-disk-restore-point-encryption-set must be same.') - if data_disk_restore_point_encryption_type is not None and ( - len(source_data_disk_resource) != len(data_disk_restore_point_encryption_type)): - raise ArgumentUsageError( - 'Length of --source-data-disk-resource, --data-disk-restore-point-encryption-type must be same.') - - for i, v in enumerate(source_data_disk_resource): - data_disks.append({ - 'diskRestorePoint': { - 'sourceDiskRestorePoint': { - 'id': v - }, - 'encryption': { - 'disk_encryption_set': { - 'id': data_disk_restore_point_encryption_set[ - i] if data_disk_restore_point_encryption_set is not None else None - }, - 'type': data_disk_restore_point_encryption_type[ - i] if data_disk_restore_point_encryption_type is not None else None - } - } - }) - if data_disks: - storage_profile['dataDisks'] = data_disks - - if storage_profile: - parameters['sourceMetadata'] = {'storageProfile': storage_profile} - return sdk_no_wait(no_wait, - client.begin_create, - resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - restore_point_name=restore_point_name, - parameters=parameters) - - -def restore_point_show(client, - resource_group_name, - restore_point_name, - restore_point_collection_name, - expand=None, - instance_view=None): - if instance_view is not None: - expand = 'instanceView' - return client.get(resource_group_name=resource_group_name, - restore_point_name=restore_point_name, - restore_point_collection_name=restore_point_collection_name, - expand=expand) - - -# endRegion - - -# region Restore point collection -def restore_point_collection_show(client, - resource_group_name, - restore_point_collection_name, - expand=None, - restore_points=None): - if restore_points is not None: - expand = 'restorePoints' - return client.get(resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - expand=expand) - - -def restore_point_collection_create(client, - resource_group_name, - restore_point_collection_name, - location, - source_id, - tags=None): - parameters = {} - properties = {} - parameters['location'] = location - if tags is not None: - parameters['tags'] = tags - properties['source'] = {'id': source_id} - parameters['properties'] = properties - return client.create_or_update(resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - parameters=parameters) - - -def restore_point_collection_update(client, - resource_group_name, - restore_point_collection_name, - tags=None): - parameters = {} - if tags is not None: - parameters['tags'] = tags - return client.update(resource_group_name=resource_group_name, - restore_point_collection_name=restore_point_collection_name, - parameters=parameters) - - -# endRegion - - -def _transform_community_gallery_list_output(result): - result_data = result.get('data') - if not result_data: - return [] - - output = [] - for data_item in result_data: - from collections import OrderedDict - output_item = OrderedDict() - output_item['id'] = data_item.get('id') - output_item['location'] = data_item.get('location') - output_item['name'] = data_item.get('name') - - properties = data_item.get('properties') - if properties: - output_item['communityMetadata'] = properties.get('communityMetadata', {}) - output_item['uniqueId'] = properties.get('identifier', {}).get('uniqueId') - - output.append(output_item) - - return output - - -def sig_community_image_definition_list(client, location, public_gallery_name, marker=None, show_next_marker=None): - generator = client.list(location=location, public_gallery_name=public_gallery_name) - return get_page_result(generator, marker, show_next_marker) - - -def sig_community_image_version_list(client, location, public_gallery_name, gallery_image_name, marker=None, - show_next_marker=None): - generator = client.list(location=location, public_gallery_name=public_gallery_name, - gallery_image_name=gallery_image_name) - return get_page_result(generator, marker, show_next_marker) -# endRegion diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/disk_encryption.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/disk_encryption.py deleted file mode 100644 index 15a2e075d7d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/disk_encryption.py +++ /dev/null @@ -1,575 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -import os -import uuid - -from knack.log import get_logger - -from azure.cli.command_modules.vm.azure_stack._vm_utils import get_key_vault_base_url, \ - create_data_plane_keyvault_key_client -from azure.cli.command_modules.vm.azure_stack.custom import set_vm, _compute_client_factory, _is_linux_os -from azure.cli.core.commands import LongRunningOperation - -_DATA_VOLUME_TYPE = 'DATA' -_ALL_VOLUME_TYPE = 'ALL' -_STATUS_ENCRYPTED = 'Encrypted' - -logger = get_logger(__name__) - -vm_extension_info = { - 'Linux': { - 'publisher': os.environ.get('ADE_TEST_EXTENSION_PUBLISHER') or 'Microsoft.Azure.Security', - 'name': os.environ.get('ADE_TEST_EXTENSION_NAME') or 'AzureDiskEncryptionForLinux', - 'version': '1.1', - 'legacy_version': '0.1' - }, - 'Windows': { - 'publisher': os.environ.get('ADE_TEST_EXTENSION_PUBLISHER') or 'Microsoft.Azure.Security', - 'name': os.environ.get('ADE_TEST_EXTENSION_NAME') or 'AzureDiskEncryption', - 'version': '2.2', - 'legacy_version': '1.1' - } -} - - -def _find_existing_ade(vm, use_instance_view=False, ade_ext_info=None): - if not ade_ext_info: - ade_ext_info = vm_extension_info['Linux'] if _is_linux_os(vm) else vm_extension_info['Windows'] - if use_instance_view: - exts = vm.instance_view.extensions or [] - r = next((e for e in exts if e.type and e.type.lower().startswith(ade_ext_info['publisher'].lower()) and - e.name.lower() == ade_ext_info['name'].lower()), None) - else: - exts = vm.resources or [] - r = next((e for e in exts if (e.publisher.lower() == ade_ext_info['publisher'].lower() and - e.type_properties_type.lower() == ade_ext_info['name'].lower())), None) - return r - - -def _detect_ade_status(vm): - if vm.storage_profile.os_disk.encryption_settings: - return False, True - ade_ext_info = vm_extension_info['Linux'] if _is_linux_os(vm) else vm_extension_info['Windows'] - ade = _find_existing_ade(vm, ade_ext_info=ade_ext_info) - if ade is None: - return False, False - if ade.type_handler_version.split('.')[0] == ade_ext_info['legacy_version'].split('.', maxsplit=1)[0]: - return False, True - - return True, False # we believe impossible to have both old & new ADE - - -def encrypt_vm(cmd, resource_group_name, vm_name, # pylint: disable=too-many-locals, too-many-statements - disk_encryption_keyvault, - aad_client_id=None, - aad_client_secret=None, aad_client_cert_thumbprint=None, - key_encryption_keyvault=None, - key_encryption_key=None, - key_encryption_algorithm='RSA-OAEP', - volume_type=None, - encrypt_format_all=False, - force=False): - from azure.mgmt.core.tools import parse_resource_id - from knack.util import CLIError - - # pylint: disable=no-member - compute_client = _compute_client_factory(cmd.cli_ctx) - vm = compute_client.virtual_machines.get(resource_group_name, vm_name) - is_linux = _is_linux_os(vm) - backup_encryption_settings = vm.storage_profile.os_disk.encryption_settings - vm_encrypted = backup_encryption_settings.enabled if backup_encryption_settings else False - _, has_old_ade = _detect_ade_status(vm) - use_new_ade = not aad_client_id and not has_old_ade - extension = vm_extension_info['Linux' if is_linux else 'Windows'] - - if not use_new_ade and not aad_client_id: - raise CLIError('Please provide --aad-client-id') - - # 1. First validate arguments - if not use_new_ade and not aad_client_cert_thumbprint and not aad_client_secret: - raise CLIError('Please provide either --aad-client-cert-thumbprint or --aad-client-secret') - - if volume_type is None: - if not is_linux: - volume_type = _ALL_VOLUME_TYPE - elif vm.storage_profile.data_disks: - raise CLIError('VM has data disks, please supply --volume-type') - else: - volume_type = 'OS' - - # sequence_version should be unique - sequence_version = uuid.uuid4() - - # retrieve keyvault details - disk_encryption_keyvault_url = get_key_vault_base_url( - cmd.cli_ctx, (parse_resource_id(disk_encryption_keyvault))['name']) - - # disk encryption key itself can be further protected, so let us verify - if key_encryption_key: - key_encryption_keyvault = key_encryption_keyvault or disk_encryption_keyvault - - # to avoid bad server errors, ensure the vault has the right configurations - _verify_keyvault_good_for_encryption(cmd.cli_ctx, disk_encryption_keyvault, key_encryption_keyvault, vm, force) - - # if key name and not key url, get url. - if key_encryption_key and '://' not in key_encryption_key: # if key name and not key url - key_encryption_key = _get_keyvault_key_url( - cmd.cli_ctx, (parse_resource_id(key_encryption_keyvault))['name'], key_encryption_key) - - # 2. we are ready to provision/update the disk encryption extensions - # The following logic was mostly ported from xplat-cli - public_config = { - 'KeyVaultURL': disk_encryption_keyvault_url, - 'VolumeType': volume_type, - 'EncryptionOperation': 'EnableEncryption' if not encrypt_format_all else 'EnableEncryptionFormatAll', - 'KeyEncryptionKeyURL': key_encryption_key, - 'KeyEncryptionAlgorithm': key_encryption_algorithm, - 'SequenceVersion': sequence_version, - } - if use_new_ade: - public_config.update({ - "KeyVaultResourceId": disk_encryption_keyvault, - "KekVaultResourceId": key_encryption_keyvault if key_encryption_key else '', - }) - else: - public_config.update({ - 'AADClientID': aad_client_id, - 'AADClientCertThumbprint': aad_client_cert_thumbprint, - }) - - ade_legacy_private_config = { - 'AADClientSecret': aad_client_secret if is_linux else (aad_client_secret or '') - } - - VirtualMachineExtension, DiskEncryptionSettings, KeyVaultSecretReference, KeyVaultKeyReference, SubResource = \ - cmd.get_models('VirtualMachineExtension', 'DiskEncryptionSettings', 'KeyVaultSecretReference', - 'KeyVaultKeyReference', 'SubResource') - - ext = VirtualMachineExtension( - location=vm.location, # pylint: disable=no-member - publisher=extension['publisher'], - type_properties_type=extension['name'], - protected_settings=None if use_new_ade else ade_legacy_private_config, - type_handler_version=extension['version'] if use_new_ade else extension['legacy_version'], - settings=public_config, - auto_upgrade_minor_version=True) - - poller = compute_client.virtual_machine_extensions.begin_create_or_update( - resource_group_name, vm_name, extension['name'], ext) - LongRunningOperation(cmd.cli_ctx)(poller) - poller.result() - - # verify the extension was ok - extension_result = compute_client.virtual_machine_extensions.get( - resource_group_name, vm_name, extension['name'], expand='instanceView') - if extension_result.provisioning_state != 'Succeeded': - raise CLIError('Extension needed for disk encryption was not provisioned correctly') - - if not use_new_ade: - if not (extension_result.instance_view.statuses and - extension_result.instance_view.statuses[0].message): - raise CLIError('Could not find url pointing to the secret for disk encryption') - - # 3. update VM's storage profile with the secrets - status_url = extension_result.instance_view.statuses[0].message - - vm = compute_client.virtual_machines.get(resource_group_name, vm_name) - secret_ref = KeyVaultSecretReference(secret_url=status_url, - source_vault=SubResource(id=disk_encryption_keyvault)) - - key_encryption_key_obj = None - if key_encryption_key: - key_encryption_key_obj = KeyVaultKeyReference(key_url=key_encryption_key, - source_vault=SubResource(id=key_encryption_keyvault)) - - disk_encryption_settings = DiskEncryptionSettings(disk_encryption_key=secret_ref, - key_encryption_key=key_encryption_key_obj, - enabled=True) - if vm_encrypted: - # stop the vm before update if the vm is already encrypted - logger.warning("Deallocating the VM before updating encryption settings...") - compute_client.virtual_machines.deallocate(resource_group_name, vm_name).result() - vm = compute_client.virtual_machines.get(resource_group_name, vm_name) - - vm.storage_profile.os_disk.encryption_settings = disk_encryption_settings - set_vm(cmd, vm) - - if vm_encrypted: - # and start after the update - logger.warning("Restarting the VM after the update...") - compute_client.virtual_machines.start(resource_group_name, vm_name).result() - - if is_linux and volume_type != _DATA_VOLUME_TYPE: - old_ade_msg = "If you see 'VMRestartPending', please restart the VM, and the encryption will finish shortly" - logger.warning("The encryption request was accepted. Please use 'show' command to monitor " - "the progress. %s", "" if use_new_ade else old_ade_msg) - - -def decrypt_vm(cmd, resource_group_name, vm_name, volume_type=None, force=False): - from knack.util import CLIError - - compute_client = _compute_client_factory(cmd.cli_ctx) - vm = compute_client.virtual_machines.get(resource_group_name, vm_name) - has_new_ade, has_old_ade = _detect_ade_status(vm) - if not has_new_ade and not has_old_ade: - logger.warning('Azure Disk Encryption is not enabled') - return - is_linux = _is_linux_os(vm) - # pylint: disable=no-member - - # 1. be nice, figure out the default volume type and also verify VM will not be busted - if is_linux: - if volume_type: - if not force and volume_type != _DATA_VOLUME_TYPE: - raise CLIError("Only Data disks can have encryption disabled in a Linux VM. " - "Use '--force' to ignore the warning") - else: - volume_type = _DATA_VOLUME_TYPE - elif volume_type is None: - volume_type = _ALL_VOLUME_TYPE - - extension = vm_extension_info['Linux' if is_linux else 'Windows'] - # sequence_version should be incremented since encryptions occurred before - sequence_version = uuid.uuid4() - - # 2. update the disk encryption extension - # The following logic was mostly ported from xplat-cli - public_config = { - 'VolumeType': volume_type, - 'EncryptionOperation': 'DisableEncryption', - 'SequenceVersion': sequence_version, - } - - VirtualMachineExtension, DiskEncryptionSettings = cmd.get_models( - 'VirtualMachineExtension', 'DiskEncryptionSettings') - - ext = VirtualMachineExtension( - location=vm.location, # pylint: disable=no-member - publisher=extension['publisher'], - virtual_machine_extension_type=extension['name'], - type_handler_version=extension['version'] if has_new_ade else extension['legacy_version'], - settings=public_config, - auto_upgrade_minor_version=True) - - poller = compute_client.virtual_machine_extensions.begin_create_or_update(resource_group_name, - vm_name, - extension['name'], ext) - LongRunningOperation(cmd.cli_ctx)(poller) - poller.result() - extension_result = compute_client.virtual_machine_extensions.get(resource_group_name, vm_name, - extension['name'], - expand='instanceView') - if extension_result.provisioning_state != 'Succeeded': - raise CLIError("Extension updating didn't succeed") - - if not has_new_ade: - # 3. Remove the secret from VM's storage profile - vm = compute_client.virtual_machines.get(resource_group_name, vm_name) - disk_encryption_settings = DiskEncryptionSettings(enabled=False) - vm.storage_profile.os_disk.encryption_settings = disk_encryption_settings - set_vm(cmd, vm) - - -def _show_vm_encryption_status_thru_new_ade(vm_instance_view): - ade = _find_existing_ade(vm_instance_view, use_instance_view=True) - disk_infos = [] - for div in vm_instance_view.instance_view.disks or []: - disk_infos.append({ - 'name': div.name, - 'encryptionSettings': div.encryption_settings, - 'statuses': [x for x in (div.statuses or []) if (x.code or '').startswith('EncryptionState')], - }) - - return { - 'status': ade.statuses if ade else None, - 'substatus': ade.substatuses if ade else None, - 'disks': disk_infos - } - - -def show_vm_encryption_status(cmd, resource_group_name, vm_name): - encryption_status = { - 'osDisk': 'NotEncrypted', - 'osDiskEncryptionSettings': None, - 'dataDisk': 'NotEncrypted', - 'osType': None - } - compute_client = _compute_client_factory(cmd.cli_ctx) - vm = compute_client.virtual_machines.get(resource_group_name, vm_name, expand='instanceView') - has_new_ade, has_old_ade = _detect_ade_status(vm) - if not has_new_ade and not has_old_ade: - logger.warning('Azure Disk Encryption is not enabled') - return None - if has_new_ade: - return _show_vm_encryption_status_thru_new_ade(vm) - is_linux = _is_linux_os(vm) - - # pylint: disable=no-member - # The following logic was mostly ported from xplat-cli - os_type = 'Linux' if is_linux else 'Windows' - encryption_status['osType'] = os_type - extension = vm_extension_info[os_type] - extension_result = compute_client.virtual_machine_extensions.get(resource_group_name, - vm_name, - extension['name'], - expand='instanceView') - logger.debug(extension_result) - if extension_result.instance_view and extension_result.instance_view.statuses: - encryption_status['progressMessage'] = extension_result.instance_view.statuses[0].message - - substatus_message = None - if getattr(extension_result.instance_view, 'substatuses', None): - substatus_message = extension_result.instance_view.substatuses[0].message - - encryption_status['osDiskEncryptionSettings'] = vm.storage_profile.os_disk.encryption_settings - - import json - if is_linux: - try: - message_object = json.loads(substatus_message) - except Exception: # pylint: disable=broad-except - message_object = None # might be from outdated extension - - if message_object and ('os' in message_object): - encryption_status['osDisk'] = message_object['os'] - else: - encryption_status['osDisk'] = 'Unknown' - - if message_object and 'data' in message_object: - encryption_status['dataDisk'] = message_object['data'] - else: - encryption_status['dataDisk'] = 'Unknown' - else: - # Windows - get os and data volume encryption state from the vm model - if (encryption_status['osDiskEncryptionSettings'] and - encryption_status['osDiskEncryptionSettings'].enabled and - encryption_status['osDiskEncryptionSettings'].disk_encryption_key and - encryption_status['osDiskEncryptionSettings'].disk_encryption_key.secret_url): - encryption_status['osDisk'] = _STATUS_ENCRYPTED - else: - encryption_status['osDisk'] = 'Unknown' - - if extension_result.provisioning_state == 'Succeeded': - volume_type = extension_result.settings.get('VolumeType', None) - about_data_disk = not volume_type or volume_type.lower() != 'os' - if about_data_disk and extension_result.settings.get('EncryptionOperation', None) == 'EnableEncryption': - encryption_status['dataDisk'] = _STATUS_ENCRYPTED - - return encryption_status - - -def _get_keyvault_key_url(cli_ctx, keyvault_name, key_name): - vault_base_url = get_key_vault_base_url(cli_ctx, keyvault_name) - client = create_data_plane_keyvault_key_client(cli_ctx, vault_base_url) - key = client.get_key(key_name) - return key.id - - -def _handles_default_volume_type_for_vmss_encryption(is_linux, volume_type, force): - if is_linux: - volume_type = volume_type or _DATA_VOLUME_TYPE - if volume_type != _DATA_VOLUME_TYPE: - msg = 'OS disk encyrption is not yet supported for Linux VM scale sets' - if force: - logger.warning(msg) - else: - from knack.util import CLIError - raise CLIError(msg) - else: - volume_type = volume_type or _ALL_VOLUME_TYPE - return volume_type - - -def encrypt_vmss(cmd, resource_group_name, vmss_name, # pylint: disable=too-many-locals, too-many-statements - disk_encryption_keyvault, - key_encryption_keyvault=None, - key_encryption_key=None, - key_encryption_algorithm='RSA-OAEP', - volume_type=None, - force=False): - from azure.mgmt.core.tools import parse_resource_id - - # pylint: disable=no-member - UpgradeMode, VirtualMachineScaleSetExtension, VirtualMachineScaleSetExtensionProfile = cmd.get_models( - 'UpgradeMode', 'VirtualMachineScaleSetExtension', 'VirtualMachineScaleSetExtensionProfile') - - compute_client = _compute_client_factory(cmd.cli_ctx) - vmss = compute_client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - is_linux = _is_linux_os(vmss.virtual_machine_profile) - extension = vm_extension_info['Linux' if is_linux else 'Windows'] - - # 1. First validate arguments - volume_type = _handles_default_volume_type_for_vmss_encryption(is_linux, volume_type, force) - - # retrieve keyvault details - disk_encryption_keyvault_url = get_key_vault_base_url(cmd.cli_ctx, - (parse_resource_id(disk_encryption_keyvault))['name']) - - # disk encryption key itself can be further protected, so let us verify - if key_encryption_key: - key_encryption_keyvault = key_encryption_keyvault or disk_encryption_keyvault - - # to avoid bad server errors, ensure the vault has the right configurations - _verify_keyvault_good_for_encryption(cmd.cli_ctx, disk_encryption_keyvault, key_encryption_keyvault, vmss, force) - - # if key name and not key url, get url. - if key_encryption_key and '://' not in key_encryption_key: - key_encryption_key = _get_keyvault_key_url( - cmd.cli_ctx, (parse_resource_id(key_encryption_keyvault))['name'], key_encryption_key) - - # 2. we are ready to provision/update the disk encryption extensions - public_config = { - 'KeyVaultURL': disk_encryption_keyvault_url, - 'KeyEncryptionKeyURL': key_encryption_key or '', - "KeyVaultResourceId": disk_encryption_keyvault, - "KekVaultResourceId": key_encryption_keyvault if key_encryption_key else '', - 'KeyEncryptionAlgorithm': key_encryption_algorithm if key_encryption_key else '', - 'VolumeType': volume_type, - 'EncryptionOperation': 'EnableEncryption' - } - - ext = VirtualMachineScaleSetExtension(name=extension['name'], - publisher=extension['publisher'], - type_properties_type=extension['name'], - type_handler_version=extension['version'], - settings=public_config, - auto_upgrade_minor_version=True, - force_update_tag=uuid.uuid4()) - exts = [ext] - - # remove any old ade extensions set by this command and add the new one. - vmss_ext_profile = vmss.virtual_machine_profile.extension_profile - if vmss_ext_profile and vmss_ext_profile.extensions: - exts.extend(old_ext for old_ext in vmss.virtual_machine_profile.extension_profile.extensions - if old_ext.type != ext.type or old_ext.name != ext.name) - vmss.virtual_machine_profile.extension_profile = VirtualMachineScaleSetExtensionProfile(extensions=exts) - - # Avoid unnecessary permission error - vmss.virtual_machine_profile.storage_profile.image_reference = None - - poller = compute_client.virtual_machine_scale_sets.begin_create_or_update(resource_group_name, vmss_name, vmss) - LongRunningOperation(cmd.cli_ctx)(poller) - _show_post_action_message(resource_group_name, vmss.name, vmss.upgrade_policy.mode == UpgradeMode.manual, True) - - -def decrypt_vmss(cmd, resource_group_name, vmss_name, volume_type=None, force=False): - UpgradeMode, VirtualMachineScaleSetExtension = cmd.get_models('UpgradeMode', 'VirtualMachineScaleSetExtension') - compute_client = _compute_client_factory(cmd.cli_ctx) - vmss = compute_client.virtual_machine_scale_sets.get(resource_group_name, vmss_name) - is_linux = _is_linux_os(vmss.virtual_machine_profile) - extension = vm_extension_info['Linux' if is_linux else 'Windows'] - - # 1. be nice, figure out the default volume type - volume_type = _handles_default_volume_type_for_vmss_encryption(is_linux, volume_type, force) - - # 2. update the disk encryption extension - public_config = { - 'VolumeType': volume_type, - 'EncryptionOperation': 'DisableEncryption', - } - - ext = VirtualMachineScaleSetExtension(name=extension['name'], - publisher=extension['publisher'], - type_properties_type=extension['name'], - type_handler_version=extension['version'], - settings=public_config, - auto_upgrade_minor_version=True, - force_update_tag=uuid.uuid4()) - if (not vmss.virtual_machine_profile.extension_profile or - not vmss.virtual_machine_profile.extension_profile.extensions): - extensions = [] - else: - extensions = vmss.virtual_machine_profile.extension_profile.extensions - - ade_extension = [x for x in extensions if - x.type_properties_type.lower() == extension['name'].lower() and x.publisher.lower() == extension[ - 'publisher'].lower()] # pylint: disable=line-too-long - if not ade_extension: - from knack.util import CLIError - raise CLIError("VM scale set '{}' was not encrypted".format(vmss_name)) - - index = vmss.virtual_machine_profile.extension_profile.extensions.index(ade_extension[0]) - vmss.virtual_machine_profile.extension_profile.extensions[index] = ext - - # Avoid unnecessary permission error - vmss.virtual_machine_profile.storage_profile.image_reference = None - - poller = compute_client.virtual_machine_scale_sets.begin_create_or_update(resource_group_name, vmss_name, vmss) - LongRunningOperation(cmd.cli_ctx)(poller) - _show_post_action_message(resource_group_name, vmss.name, vmss.upgrade_policy.mode == UpgradeMode.manual, False) - - -def _show_post_action_message(resource_group_name, vmss_name, maunal_mode, enable): - msg = '' - if maunal_mode: - msg = ("With manual upgrade mode, you will need to run 'az vmss update-instances -g {} -n {} " - "--instance-ids \"*\"' to propagate the change.\n".format(resource_group_name, vmss_name)) - msg += ("Note, {} encryption will take a while to finish. Please query the status using " - "'az vmss encryption show -g {} -n {}'. For Linux VM, you will lose the access during the period".format( - 'enabling' if enable else 'disabling', resource_group_name, vmss_name)) - logger.warning(msg) - - -def show_vmss_encryption_status(cmd, resource_group_name, vmss_name): - client = _compute_client_factory(cmd.cli_ctx) - vm_instances = list(client.virtual_machine_scale_set_vms.list(resource_group_name, vmss_name, - select='instanceView', expand='instanceView')) - result = [] - for instance in vm_instances: - view = instance.instance_view - disk_infos = [] - vm_enc_info = { - 'id': instance.id, - 'disks': disk_infos - } - for div in view.disks: - disk_infos.append({ - 'name': div.name, - 'encryptionSettings': div.encryption_settings, - 'statuses': [x for x in (div.statuses or []) if (x.code or '').startswith('EncryptionState')] - }) - - result.append(vm_enc_info) - return result - - -def _verify_keyvault_good_for_encryption(cli_ctx, disk_vault_id, kek_vault_id, vm_or_vmss, force): - def _report_client_side_validation_error(msg): - if force: - logger.warning("WARNING: %s %s", msg, "Encryption might fail.") - else: - from knack.util import CLIError - raise CLIError("ERROR: {}".format(msg)) - - resource_type = "VMSS" if vm_or_vmss.type.lower().endswith("virtualmachinescalesets") else "VM" - - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.cli.core.profiles import ResourceType - from azure.mgmt.core.tools import parse_resource_id - - client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_KEYVAULT).vaults - disk_vault_resource_info = parse_resource_id(disk_vault_id) - key_vault = client.get(disk_vault_resource_info['resource_group'], disk_vault_resource_info['name']) - - # ensure vault has 'EnabledForDiskEncryption' permission - if not key_vault.properties or not key_vault.properties.enabled_for_disk_encryption: - _report_client_side_validation_error("Keyvault '{}' is not enabled for disk encryption.".format( - disk_vault_resource_info['resource_name'])) - - if kek_vault_id: - kek_vault_info = parse_resource_id(kek_vault_id) - if disk_vault_resource_info['name'].lower() != kek_vault_info['name'].lower(): - client.get(kek_vault_info['resource_group'], kek_vault_info['name']) - - # verify subscription mataches - vm_vmss_resource_info = parse_resource_id(vm_or_vmss.id) - if vm_vmss_resource_info['subscription'].lower() != disk_vault_resource_info['subscription'].lower(): - _report_client_side_validation_error("{} {}'s subscription does not match keyvault's subscription." - .format(resource_type, vm_vmss_resource_info['name'])) - - # verify region matches - if key_vault.location.replace(' ', '').lower() != vm_or_vmss.location.replace(' ', '').lower(): - _report_client_side_validation_error( - "{} {}'s region does not match keyvault's region.".format(resource_type, vm_vmss_resource_info['name'])) diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/__init__.py deleted file mode 100644 index 34913fb394d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/_params.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/_params.py deleted file mode 100644 index 6edc353cdef..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/_params.py +++ /dev/null @@ -1,9 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-argument, too-many-locals, too-many-branches, too-many-statements - - -def load_arguments(self, _): - pass diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/commands.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/commands.py deleted file mode 100644 index 4ca254e2461..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/commands.py +++ /dev/null @@ -1,34 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-argument, too-many-locals, too-many-branches, too-many-statements -from azure.cli.command_modules.vm.azure_stack._format import ( - transform_disk_show_table_output, - transform_vmss_list_with_zones_table_output) - -from .operations._util import import_aaz_by_profile - - -def load_command_table(self, _): - Disk = import_aaz_by_profile("disk") - self.command_table['disk list'] = Disk.List(loader=self, table_transformer='[].' + transform_disk_show_table_output) - self.command_table['disk show'] = Disk.Show(loader=self, table_transformer=transform_disk_show_table_output) - - from .operations.disk import DiskUpdate, DiskGrantAccess - self.command_table["disk grant-access"] = DiskGrantAccess(loader=self) - self.command_table["disk update"] = DiskUpdate(loader=self) - - VMSS = import_aaz_by_profile("vmss") - self.command_table['vmss list'] = VMSS.List(loader=self, - table_transformer=transform_vmss_list_with_zones_table_output) - - from .operations.vm_availability_set import AvailabilitySetUpdate, AvailabilitySetConvert - self.command_table['vm availability-set update'] = AvailabilitySetUpdate(loader=self) - self.command_table['vm availability-set convert'] = AvailabilitySetConvert(loader=self) - - from .operations.capacity_reservation_group import CapacityReservationGroupList - self.command_table['capacity reservation group list'] = CapacityReservationGroupList(loader=self) - - from .operations.vm import VMListSizes - self.command_table['vm list-sizes'] = VMListSizes(loader=self) diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/__init__.py deleted file mode 100644 index fca9bdf191e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-import -from ._util import import_aaz_by_profile diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/_util.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/_util.py deleted file mode 100644 index a03409c27c4..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/_util.py +++ /dev/null @@ -1,9 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -import importlib - - -def import_aaz_by_profile(module_name): - return importlib.import_module(f"azure.cli.command_modules.vm.aaz.profile_2018_03_01_hybrid.{module_name}") diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/capacity_reservation_group.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/capacity_reservation_group.py deleted file mode 100644 index 0c447c7be0e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/capacity_reservation_group.py +++ /dev/null @@ -1,42 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_CapacityReservationGroup = import_aaz_by_profile("capacity.reservation.group") - - -class CapacityReservationGroupList(_CapacityReservationGroup.List): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZBoolArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vm_instance = AAZBoolArg( - options=['--vm-instance'], - help="Retrieve the Virtual Machine Instance " - "which are associated to capacity reservation group in the response.", - nullable=True - ) - args_schema.vmss_instance = AAZBoolArg( - options=['--vmss-instance'], - help="Retrieve the ScaleSet VM Instance which are associated to capacity reservation group in the response.", - nullable=True - ) - args_schema.expand._registered = False - return args_schema - - def pre_operations(self): - from azure.cli.core.aaz import has_value - args = self.ctx.args - if args.vm_instance: - args.expand = "virtualMachines/$ref" - if args.vmss_instance: - if has_value(args.expand): - args.expand = args.expand.to_serialized_data() + ",virtualMachineScaleSetVMs/$ref" - else: - args.expand = "virtualMachineScaleSetVMs/$ref" diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/disk.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/disk.py deleted file mode 100644 index d700d2de42e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/disk.py +++ /dev/null @@ -1,45 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_Disk = import_aaz_by_profile("disk") - - -class DiskUpdate(_Disk.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.disk_encryption_set_id._registered = False - args_schema.data_access_auth_mode._registered = False - args_schema.disk_access_id._registered = False - args_schema.public_network_access._registered = False - args_schema.accelerated_network._registered = False - args_schema.architecture._registered = False - args_schema.encryption_type._registered = False - args_schema.disk_iops_read_write._registered = False - args_schema.disk_mbps_read_write._registered = False - args_schema.network_access_policy._registered = False - - return args_schema - - -class DiskGrantAccess(_Disk.GrantAccess): - def pre_operations(self): - args = self.ctx.args - - disk_info = _Disk.Show(cli_ctx=self.cli_ctx)(command_args={ - "disk_name": args.disk_name, - "resource_group": args.resource_group - }) - - if disk_info.get("creation_data", None) and \ - disk_info["creation_data"].get("create_option", None) == "UploadPreparedSecure": - args.secure_vm_guest_state_sas = True diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/vm.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/vm.py deleted file mode 100644 index 346c5f00b6c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/vm.py +++ /dev/null @@ -1,21 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_VM = import_aaz_by_profile("vm") - - -class VMListSizes(_VM.ListSizes): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location._id_part = None - - return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/vm_availability_set.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/vm_availability_set.py deleted file mode 100644 index 59b0cb73f35..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2018_03_01_hybrid/operations/vm_availability_set.py +++ /dev/null @@ -1,77 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from azure.cli.core.aaz import register_command -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_AvailabilitySet = import_aaz_by_profile("vm.availability_set") - -PPG_RID_TEMPLATE = "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/proximityPlacementGroups/{}" - - -class AvailabilitySetUpdate(_AvailabilitySet.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.sku._registered = False - args_schema.platform_fault_domain_count._registered = False - return args_schema - - -@register_command( - 'vm availability-set convert' -) -class AvailabilitySetConvert(_AvailabilitySet.Update): - """Convert an Azure Availability Set to contain VMs with managed disks. - - :example: Convert an availabiity set to use managed disks by name. - az vm availability-set convert -g MyResourceGroup -n MyAvSet - - :example: Convert an availability set to use managed disks by ID. - az vm availability-set convert --ids $(az vm availability-set list -g MyResourceGroup --query "[].id" -o tsv) - """ - - AZ_SUPPORT_GENERIC_UPDATE = False - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.sku._registered = False - args_schema.platform_fault_domain_count._registered = False - return args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(ctx=self.ctx)() - if self.pre_instance_update(self.ctx.vars.instance): - return - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.AvailabilitySetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - def pre_instance_update(self, instance): - # end the operation if the availability set is already configured for managed disks - if instance.sku.name == 'Aligned': - logger.warning("Availability set '%s' is already configured for managed disks.", instance.name) - return True - - instance.sku.name = 'Aligned' - - # double check whether the existing FD number is supported - from ...custom import list_skus - skus = list_skus(self, instance.location) - av_sku = next((s for s in skus if s['resourceType'] == 'availabilitySets' and s['name'] == 'Aligned'), None) - if av_sku and av_sku['capabilities']: - max_fd = int(next((c['value'] for c in av_sku['capabilities'] if c['name'] == 'MaximumPlatformFaultDomainCount'), '0')) - if max_fd and max_fd < instance.properties.platform_fault_domain_count: - logger.warning("The fault domain count will be adjusted from %s to %s so to stay within region's " - "limitation", instance.properties.platform_fault_domain_count, max_fd) - instance.properties.platform_fault_domain_count = max_fd diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/__init__.py deleted file mode 100644 index 34913fb394d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/_params.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/_params.py deleted file mode 100644 index 6edc353cdef..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/_params.py +++ /dev/null @@ -1,9 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-argument, too-many-locals, too-many-branches, too-many-statements - - -def load_arguments(self, _): - pass diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/commands.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/commands.py deleted file mode 100644 index 4ca254e2461..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/commands.py +++ /dev/null @@ -1,34 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-argument, too-many-locals, too-many-branches, too-many-statements -from azure.cli.command_modules.vm.azure_stack._format import ( - transform_disk_show_table_output, - transform_vmss_list_with_zones_table_output) - -from .operations._util import import_aaz_by_profile - - -def load_command_table(self, _): - Disk = import_aaz_by_profile("disk") - self.command_table['disk list'] = Disk.List(loader=self, table_transformer='[].' + transform_disk_show_table_output) - self.command_table['disk show'] = Disk.Show(loader=self, table_transformer=transform_disk_show_table_output) - - from .operations.disk import DiskUpdate, DiskGrantAccess - self.command_table["disk grant-access"] = DiskGrantAccess(loader=self) - self.command_table["disk update"] = DiskUpdate(loader=self) - - VMSS = import_aaz_by_profile("vmss") - self.command_table['vmss list'] = VMSS.List(loader=self, - table_transformer=transform_vmss_list_with_zones_table_output) - - from .operations.vm_availability_set import AvailabilitySetUpdate, AvailabilitySetConvert - self.command_table['vm availability-set update'] = AvailabilitySetUpdate(loader=self) - self.command_table['vm availability-set convert'] = AvailabilitySetConvert(loader=self) - - from .operations.capacity_reservation_group import CapacityReservationGroupList - self.command_table['capacity reservation group list'] = CapacityReservationGroupList(loader=self) - - from .operations.vm import VMListSizes - self.command_table['vm list-sizes'] = VMListSizes(loader=self) diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/__init__.py deleted file mode 100644 index fca9bdf191e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-import -from ._util import import_aaz_by_profile diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/_util.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/_util.py deleted file mode 100644 index 4181858cd87..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/_util.py +++ /dev/null @@ -1,9 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -import importlib - - -def import_aaz_by_profile(module_name): - return importlib.import_module(f"azure.cli.command_modules.vm.aaz.profile_2019_03_01_hybrid.{module_name}") diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/capacity_reservation_group.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/capacity_reservation_group.py deleted file mode 100644 index 0c447c7be0e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/capacity_reservation_group.py +++ /dev/null @@ -1,42 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_CapacityReservationGroup = import_aaz_by_profile("capacity.reservation.group") - - -class CapacityReservationGroupList(_CapacityReservationGroup.List): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZBoolArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vm_instance = AAZBoolArg( - options=['--vm-instance'], - help="Retrieve the Virtual Machine Instance " - "which are associated to capacity reservation group in the response.", - nullable=True - ) - args_schema.vmss_instance = AAZBoolArg( - options=['--vmss-instance'], - help="Retrieve the ScaleSet VM Instance which are associated to capacity reservation group in the response.", - nullable=True - ) - args_schema.expand._registered = False - return args_schema - - def pre_operations(self): - from azure.cli.core.aaz import has_value - args = self.ctx.args - if args.vm_instance: - args.expand = "virtualMachines/$ref" - if args.vmss_instance: - if has_value(args.expand): - args.expand = args.expand.to_serialized_data() + ",virtualMachineScaleSetVMs/$ref" - else: - args.expand = "virtualMachineScaleSetVMs/$ref" diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/disk.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/disk.py deleted file mode 100644 index d700d2de42e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/disk.py +++ /dev/null @@ -1,45 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_Disk = import_aaz_by_profile("disk") - - -class DiskUpdate(_Disk.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.disk_encryption_set_id._registered = False - args_schema.data_access_auth_mode._registered = False - args_schema.disk_access_id._registered = False - args_schema.public_network_access._registered = False - args_schema.accelerated_network._registered = False - args_schema.architecture._registered = False - args_schema.encryption_type._registered = False - args_schema.disk_iops_read_write._registered = False - args_schema.disk_mbps_read_write._registered = False - args_schema.network_access_policy._registered = False - - return args_schema - - -class DiskGrantAccess(_Disk.GrantAccess): - def pre_operations(self): - args = self.ctx.args - - disk_info = _Disk.Show(cli_ctx=self.cli_ctx)(command_args={ - "disk_name": args.disk_name, - "resource_group": args.resource_group - }) - - if disk_info.get("creation_data", None) and \ - disk_info["creation_data"].get("create_option", None) == "UploadPreparedSecure": - args.secure_vm_guest_state_sas = True diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/vm.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/vm.py deleted file mode 100644 index 346c5f00b6c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/vm.py +++ /dev/null @@ -1,21 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_VM = import_aaz_by_profile("vm") - - -class VMListSizes(_VM.ListSizes): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location._id_part = None - - return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/vm_availability_set.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/vm_availability_set.py deleted file mode 100644 index 59b0cb73f35..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2019_03_01_hybrid/operations/vm_availability_set.py +++ /dev/null @@ -1,77 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from azure.cli.core.aaz import register_command -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_AvailabilitySet = import_aaz_by_profile("vm.availability_set") - -PPG_RID_TEMPLATE = "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/proximityPlacementGroups/{}" - - -class AvailabilitySetUpdate(_AvailabilitySet.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.sku._registered = False - args_schema.platform_fault_domain_count._registered = False - return args_schema - - -@register_command( - 'vm availability-set convert' -) -class AvailabilitySetConvert(_AvailabilitySet.Update): - """Convert an Azure Availability Set to contain VMs with managed disks. - - :example: Convert an availabiity set to use managed disks by name. - az vm availability-set convert -g MyResourceGroup -n MyAvSet - - :example: Convert an availability set to use managed disks by ID. - az vm availability-set convert --ids $(az vm availability-set list -g MyResourceGroup --query "[].id" -o tsv) - """ - - AZ_SUPPORT_GENERIC_UPDATE = False - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.sku._registered = False - args_schema.platform_fault_domain_count._registered = False - return args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(ctx=self.ctx)() - if self.pre_instance_update(self.ctx.vars.instance): - return - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.AvailabilitySetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - def pre_instance_update(self, instance): - # end the operation if the availability set is already configured for managed disks - if instance.sku.name == 'Aligned': - logger.warning("Availability set '%s' is already configured for managed disks.", instance.name) - return True - - instance.sku.name = 'Aligned' - - # double check whether the existing FD number is supported - from ...custom import list_skus - skus = list_skus(self, instance.location) - av_sku = next((s for s in skus if s['resourceType'] == 'availabilitySets' and s['name'] == 'Aligned'), None) - if av_sku and av_sku['capabilities']: - max_fd = int(next((c['value'] for c in av_sku['capabilities'] if c['name'] == 'MaximumPlatformFaultDomainCount'), '0')) - if max_fd and max_fd < instance.properties.platform_fault_domain_count: - logger.warning("The fault domain count will be adjusted from %s to %s so to stay within region's " - "limitation", instance.properties.platform_fault_domain_count, max_fd) - instance.properties.platform_fault_domain_count = max_fd diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/__init__.py deleted file mode 100644 index 34913fb394d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/_params.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/_params.py deleted file mode 100644 index 6edc353cdef..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/_params.py +++ /dev/null @@ -1,9 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-argument, too-many-locals, too-many-branches, too-many-statements - - -def load_arguments(self, _): - pass diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/commands.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/commands.py deleted file mode 100644 index b43a0597f4d..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/commands.py +++ /dev/null @@ -1,53 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-argument, too-many-locals, too-many-branches, too-many-statements -from azure.cli.command_modules.vm.azure_stack._format import ( - transform_disk_show_table_output, - transform_vmss_list_with_zones_table_output) - -from .operations._util import import_aaz_by_profile - - -def load_command_table(self, _): - from .operations.ppg import PPGShow, PPGUpdate - self.command_table["ppg show"] = PPGShow(loader=self) - self.command_table["ppg update"] = PPGUpdate(loader=self) - - Disk = import_aaz_by_profile("disk") - self.command_table['disk list'] = Disk.List(loader=self, table_transformer='[].' + transform_disk_show_table_output) - self.command_table['disk show'] = Disk.Show(loader=self, table_transformer=transform_disk_show_table_output) - - from .operations.disk import DiskUpdate, DiskGrantAccess - self.command_table["disk grant-access"] = DiskGrantAccess(loader=self) - self.command_table["disk update"] = DiskUpdate(loader=self) - - from .operations.snapshot import SnapshotUpdate - self.command_table['snapshot update'] = SnapshotUpdate(loader=self) - - from .operations.vm_availability_set import AvailabilitySetUpdate, AvailabilitySetConvert - self.command_table['vm availability-set update'] = AvailabilitySetUpdate(loader=self) - self.command_table['vm availability-set convert'] = AvailabilitySetConvert(loader=self) - - VMSS = import_aaz_by_profile("vmss") - self.command_table['vmss list'] = VMSS.List(loader=self, - table_transformer=transform_vmss_list_with_zones_table_output) - - from .operations.capacity_reservation_group import CapacityReservationGroupList - self.command_table['capacity reservation group list'] = CapacityReservationGroupList(loader=self) - - from .operations.sig_image_definition import SigImageDefinitionUpdate - self.command_table['sig image-definition update'] = SigImageDefinitionUpdate(loader=self) - - from .operations.vm import VMListSizes - self.command_table['vm list-sizes'] = VMListSizes(loader=self) - - from .operations.disk_encryption_set import DiskEncryptionSetCreate, DiskEncryptionSetUpdate - self.command_table["disk-encryption-set create"] = DiskEncryptionSetCreate(loader=self) - self.command_table["disk-encryption-set update"] = DiskEncryptionSetUpdate(loader=self) - - # pylint: disable=line-too-long - SigImageVersion = import_aaz_by_profile("sig.image_version") - self.command_table['sig image-version show'] = SigImageVersion.Show(loader=self, - table_transformer='{Name:name, ResourceGroup:resourceGroup, ProvisioningState:provisioningState, TargetRegions: publishingProfile.targetRegions && join(`, `, publishingProfile.targetRegions[*].name), EdgeZones: publishingProfile.targetExtendedLocations && join(`, `, publishingProfile.targetExtendedLocations[*].name), ReplicationState:replicationStatus.aggregatedState}') diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/__init__.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/__init__.py deleted file mode 100644 index fca9bdf191e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=unused-import -from ._util import import_aaz_by_profile diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/_util.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/_util.py deleted file mode 100644 index 073ba4ab632..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/_util.py +++ /dev/null @@ -1,9 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -import importlib - - -def import_aaz_by_profile(module_name): - return importlib.import_module(f"azure.cli.command_modules.vm.aaz.profile_2020_09_01_hybrid.{module_name}") diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/capacity_reservation_group.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/capacity_reservation_group.py deleted file mode 100644 index 0c447c7be0e..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/capacity_reservation_group.py +++ /dev/null @@ -1,42 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_CapacityReservationGroup = import_aaz_by_profile("capacity.reservation.group") - - -class CapacityReservationGroupList(_CapacityReservationGroup.List): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZBoolArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.vm_instance = AAZBoolArg( - options=['--vm-instance'], - help="Retrieve the Virtual Machine Instance " - "which are associated to capacity reservation group in the response.", - nullable=True - ) - args_schema.vmss_instance = AAZBoolArg( - options=['--vmss-instance'], - help="Retrieve the ScaleSet VM Instance which are associated to capacity reservation group in the response.", - nullable=True - ) - args_schema.expand._registered = False - return args_schema - - def pre_operations(self): - from azure.cli.core.aaz import has_value - args = self.ctx.args - if args.vm_instance: - args.expand = "virtualMachines/$ref" - if args.vmss_instance: - if has_value(args.expand): - args.expand = args.expand.to_serialized_data() + ",virtualMachineScaleSetVMs/$ref" - else: - args.expand = "virtualMachineScaleSetVMs/$ref" diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/disk.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/disk.py deleted file mode 100644 index d65ae40007f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/disk.py +++ /dev/null @@ -1,95 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger -from knack.util import CLIError - -from azure.cli.core.aaz import has_value -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_Disk = import_aaz_by_profile("disk") - - -class DiskUpdate(_Disk.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.disk_encryption_set_id._registered = False - args_schema.data_access_auth_mode._registered = False - args_schema.disk_access_id._registered = False - args_schema.public_network_access._registered = False - args_schema.accelerated_network._registered = False - args_schema.architecture._registered = False - - args_schema.disk_access = AAZStrArg( - options=["--disk-access"], - help="Name or ID of the disk access resource for using private endpoints on disks.", - ) - args_schema.disk_encryption_set = AAZStrArg( - options=["--disk-encryption-set"], - help="Name or ID of disk encryption set that is used to encrypt the disk." - ) - - return args_schema - - def pre_instance_update(self, instance): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - - args = self.ctx.args - if has_value(args.disk_encryption_set): - if instance.properties.encryption.type != 'EncryptionAtRestWithCustomerKey' and \ - has_value(args.encryption_type) and \ - args.encryption_type != 'EncryptionAtRestWithCustomerKey': - raise CLIError('usage error: Please set --encryption-type to EncryptionAtRestWithCustomerKey') - - disk_encryption_set = args.disk_encryption_set - if not is_valid_resource_id(disk_encryption_set.to_serialized_data()): - disk_encryption_set = resource_id( - subscription=get_subscription_id(self.cli_ctx), resource_group=args.resource_group, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=disk_encryption_set) - - instance.properties.encryption.disk_encryption_set_id = disk_encryption_set - - if has_value(args.encryption_type): - if args.encryption_type != 'EncryptionAtRestWithCustomerKey': - instance.properties.encryption.disk_encryption_set_id = None - - if has_value(args.disk_access): - disk_access = args.disk_access - if not is_valid_resource_id(disk_access.to_serialized_data()): - disk_access = resource_id( - subscription=get_subscription_id(self.cli_ctx), resource_group=args.resource_group, - namespace='Microsoft.Compute', type='diskAccesses', name=disk_access) - instance.properties.disk_access_id = disk_access - - if has_value(args.accelerated_network) or has_value(args.architecture): - if has_value(instance.properties.supported_capabilities): - supported_capabilities = { - "accelerated_network": args.accelerated_network, - "architecture": args.architecture - } - instance.properties.supported_capabilities = supported_capabilities - else: - instance.properties.supported_capabilities.accelerated_network = args.accelerated_network - instance.properties.supported_capabilities.architecture = args.architecture - - -class DiskGrantAccess(_Disk.GrantAccess): - def pre_operations(self): - args = self.ctx.args - - disk_info = _Disk.Show(cli_ctx=self.cli_ctx)(command_args={ - "disk_name": args.disk_name, - "resource_group": args.resource_group - }) - - if disk_info.get("creation_data", None) and \ - disk_info["creation_data"].get("create_option", None) == "UploadPreparedSecure": - args.secure_vm_guest_state_sas = True diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/disk_encryption_set.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/disk_encryption_set.py deleted file mode 100644 index 99f14e4d981..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/disk_encryption_set.py +++ /dev/null @@ -1,69 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger -from ._util import import_aaz_by_profile - -from azure.mgmt.core.tools import is_valid_resource_id -from azure.cli.core.aaz import has_value, AAZBoolArg, AAZListArg, AAZResourceIdArg, AAZResourceIdArgFormat - -logger = get_logger(__name__) - -_DES = import_aaz_by_profile("disk_encryption_set") - -KV_RID_TEMPLATE = "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.KeyVault/vaults/{}" - - -class DiskEncryptionSetCreate(_DES.Create): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.mi_system_assigned = AAZBoolArg( - options=["--mi-system-assigned"], - help="Provide this flag to use system assigned identity.", - arg_group="Managed Identity" - ) - args_schema.mi_user_assigned = AAZListArg( - options=["--mi-user-assigned"], - help="Space separated resource IDs to add user-assigned identities.", - arg_group="Managed Identity" - ) - args_schema.mi_user_assigned.Element = AAZResourceIdArg( - fmt=AAZResourceIdArgFormat(template="/subscriptions/{subscription}/resourceGroups/{resource_group}" - "/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{}") - ) - args_schema.key_url._required = True - args_schema.identity._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - args.identity.type = "SystemAssigned" - if has_value(args.mi_user_assigned): - args.identity.type = "SystemAssigned, UserAssigned" if args.mi_system_assigned else "UserAssigned" - user_assigned_identities = {} - for identity in args.mi_user_assigned: - user_assigned_identities.update({ - identity.to_serialized_data(): {} - }) - args.identity.user_assigned_identities = user_assigned_identities - - if has_value(args.source_vault): - vault = args.source_vault.to_serialized_data() - args.source_vault = vault if is_valid_resource_id(vault) else KV_RID_TEMPLATE.format(self.ctx.subscription_id, args.resource_group, vault) - - -class DiskEncryptionSetUpdate(_DES.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.identity._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.source_vault): - vault = args.source_vault.to_serialized_data() - args.source_vault = vault if is_valid_resource_id(vault) else KV_RID_TEMPLATE.format(self.ctx.subscription_id, args.resource_group, vault) diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/ppg.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/ppg.py deleted file mode 100644 index ff61c841238..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/ppg.py +++ /dev/null @@ -1,37 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_PPG = import_aaz_by_profile("ppg") - - -class PPGShow(_PPG.Show): - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - from azure.cli.core.aaz import AAZArgEnum - args_schema.include_colocation_status._blank = "True" - args_schema.include_colocation_status.enum = AAZArgEnum({"True": "True", "False": "False"}) - - return args_schema - - -class PPGUpdate(_PPG.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.tags._registered = False - args_schema.colocation_status._registered = False - args_schema.location._registered = False - args_schema.proximity_placement_group_name._id_part = None - - return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/sig_image_definition.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/sig_image_definition.py deleted file mode 100644 index cb5fae2f44c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/sig_image_definition.py +++ /dev/null @@ -1,36 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_SigImageDefinition = import_aaz_by_profile("sig.image_definition") - - -class SigImageDefinitionUpdate(_SigImageDefinition.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.location._registered = False - args_schema.tags._registered = False - args_schema.architecture._registered = False - args_schema.description._registered = False - args_schema.disallowed._registered = False - args_schema.end_of_life_date._registered = False - args_schema.eula._registered = False - args_schema.features._registered = False - args_schema.hyper_v_generation._registered = False - args_schema.identifier._registered = False - args_schema.os_state._registered = False - args_schema.os_type._registered = False - args_schema.privacy_statement_uri._registered = False - args_schema.purchase_plan._registered = False - args_schema.recommended._registered = False - args_schema.release_note_uri._registered = False - - return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/snapshot.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/snapshot.py deleted file mode 100644 index 434965b80c4..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/snapshot.py +++ /dev/null @@ -1,48 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from azure.cli.core.azclierror import ArgumentUsageError -from azure.cli.core.aaz import has_value -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_Snapshot = import_aaz_by_profile("snapshot") - - -class SnapshotUpdate(_Snapshot.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - from azure.cli.core.aaz import AAZStrArg - args_schema = super()._build_arguments_schema(*args, **kwargs) - - args_schema.disk_encryption_set_id._registered = False - - args_schema.disk_encryption_set = AAZStrArg( - options=["--disk-encryption-set"], - help="Name or ID of disk encryption set that is used to encrypt the disk." - ) - - return args_schema - - def pre_instance_update(self, instance): - from azure.mgmt.core.tools import resource_id, is_valid_resource_id - from azure.cli.core.commands.client_factory import get_subscription_id - - args = self.ctx.args - if has_value(args.disk_encryption_set): - if instance.properties.encryption.type != 'EncryptionAtRestWithCustomerKey' and \ - has_value(args.encryption_type) and \ - args.encryption_type != 'EncryptionAtRestWithCustomerKey': - raise ArgumentUsageError('usage error: Please set --encryption-type to EncryptionAtRestWithCustomerKey') - - disk_encryption_set = args.disk_encryption_set - if not is_valid_resource_id(disk_encryption_set.to_serialized_data()): - disk_encryption_set = resource_id( - subscription=get_subscription_id(self.cli_ctx), resource_group=args.resource_group, - namespace='Microsoft.Compute', type='diskEncryptionSets', name=disk_encryption_set) - instance.properties.encryption.disk_encryption_set_id = disk_encryption_set diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/vm.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/vm.py deleted file mode 100644 index 346c5f00b6c..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/vm.py +++ /dev/null @@ -1,21 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_VM = import_aaz_by_profile("vm") - - -class VMListSizes(_VM.ListSizes): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.location._id_part = None - - return args_schema diff --git a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/vm_availability_set.py b/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/vm_availability_set.py deleted file mode 100644 index b3bd52e5c68..00000000000 --- a/src/azure-cli/azure/cli/command_modules/vm/azure_stack/profile_2020_09_01_hybrid/operations/vm_availability_set.py +++ /dev/null @@ -1,90 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- -# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument -from knack.log import get_logger - -from azure.mgmt.core.tools import is_valid_resource_id -from azure.cli.core.aaz import register_command, has_value, AAZStrArg -from ._util import import_aaz_by_profile - -logger = get_logger(__name__) - -_AvailabilitySet = import_aaz_by_profile("vm.availability_set") - -PPG_RID_TEMPLATE = "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/proximityPlacementGroups/{}" - - -class AvailabilitySetUpdate(_AvailabilitySet.Update): - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.ppg = AAZStrArg( - options=["--ppg"], - help="Name or ID of the proximity placement group that the availability set should be associated with." - ) - args_schema.sku._registered = False - args_schema.platform_fault_domain_count._registered = False - args_schema.proximity_placement_group._registered = False - return args_schema - - def pre_operations(self): - args = self.ctx.args - if has_value(args.ppg): - ppg = args.ppg.to_serialized_data() - args.proximity_placement_group.id = ppg if is_valid_resource_id(ppg) else PPG_RID_TEMPLATE.format(self.ctx.subscription_id, args.resource_group, ppg) - - -@register_command( - 'vm availability-set convert' -) -class AvailabilitySetConvert(_AvailabilitySet.Update): - """Convert an Azure Availability Set to contain VMs with managed disks. - - :example: Convert an availabiity set to use managed disks by name. - az vm availability-set convert -g MyResourceGroup -n MyAvSet - - :example: Convert an availability set to use managed disks by ID. - az vm availability-set convert --ids $(az vm availability-set list -g MyResourceGroup --query "[].id" -o tsv) - """ - - AZ_SUPPORT_GENERIC_UPDATE = False - - @classmethod - def _build_arguments_schema(cls, *args, **kwargs): - args_schema = super()._build_arguments_schema(*args, **kwargs) - args_schema.sku._registered = False - args_schema.platform_fault_domain_count._registered = False - args_schema.proximity_placement_group._registered = False - return args_schema - - def _execute_operations(self): - self.pre_operations() - self.AvailabilitySetsGet(ctx=self.ctx)() - if self.pre_instance_update(self.ctx.vars.instance): - return - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.AvailabilitySetsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - def pre_instance_update(self, instance): - # end the operation if the availability set is already configured for managed disks - if instance.sku.name == 'Aligned': - logger.warning("Availability set '%s' is already configured for managed disks.", instance.name) - return True - - instance.sku.name = 'Aligned' - - # double check whether the existing FD number is supported - from ...custom import list_skus - skus = list_skus(self, instance.location) - av_sku = next((s for s in skus if s['resourceType'] == 'availabilitySets' and s['name'] == 'Aligned'), None) - if av_sku and av_sku['capabilities']: - max_fd = int(next((c['value'] for c in av_sku['capabilities'] if c['name'] == 'MaximumPlatformFaultDomainCount'), '0')) - if max_fd and max_fd < instance.properties.platform_fault_domain_count: - logger.warning("The fault domain count will be adjusted from %s to %s so to stay within region's " - "limitation", instance.properties.platform_fault_domain_count, max_fd) - instance.properties.platform_fault_domain_count = max_fd