diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/__init__.py b/src/azure-cli/azure/cli/command_modules/databoxedge/__init__.py index a246c888195..497257b8412 100644 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/__init__.py @@ -1,33 +1,27 @@ -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- from azure.cli.core import AzCommandsLoader -from .generated._help import helps # pylint: disable=unused-import -try: - from .manual._help import helps # pylint: disable=reimported -except ImportError: - pass +from azure.cli.command_modules.databoxedge._help import helps # pylint: disable=unused-import +# from azure.cli.core.profiles import ResourceType # required when using python sdk -class DataBoxEdgeManagementClientCommandsLoader(AzCommandsLoader): +class DataboxedgeCommandsLoader(AzCommandsLoader): def __init__(self, cli_ctx=None): from azure.cli.core.commands import CliCommandType - from azure.cli.core.profiles import ResourceType - databoxedge_custom = CliCommandType( + custom_command_type = CliCommandType( operations_tmpl='azure.cli.command_modules.databoxedge.custom#{}') - super().__init__(cli_ctx=cli_ctx, custom_command_type=databoxedge_custom, - resource_type=ResourceType.MGMT_DATABOXEDGE) + super().__init__(cli_ctx=cli_ctx, + # resource_type=ResourceType.XXX # required when using python sdk + custom_command_type=custom_command_type) def load_command_table(self, args): - from .generated.commands import load_command_table + from azure.cli.command_modules.databoxedge.commands import load_command_table from azure.cli.core.aaz import load_aaz_command_table try: from . import aaz @@ -40,21 +34,11 @@ def load_command_table(self, args): args=args ) load_command_table(self, args) - try: - from .manual.commands import load_command_table as load_command_table_manual - load_command_table_manual(self, args) - except ImportError: - pass return self.command_table def load_arguments(self, command): - from .generated._params import load_arguments + from azure.cli.command_modules.databoxedge._params import load_arguments load_arguments(self, command) - try: - from .manual._params import load_arguments as load_arguments_manual - load_arguments_manual(self, command) - except ImportError: - pass -COMMAND_LOADER_CLS = DataBoxEdgeManagementClientCommandsLoader +COMMAND_LOADER_CLS = DataboxedgeCommandsLoader diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/_help.py b/src/azure-cli/azure/cli/command_modules/databoxedge/_help.py index 2fe1a978ab1..126d5d00714 100644 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/_help.py +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/_help.py @@ -1,15 +1,11 @@ -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- -from .generated._help import helps # pylint: disable=unused-import -try: - from .manual._help import helps # pylint: disable=reimported -except ImportError: - pass +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/_params.py b/src/azure-cli/azure/cli/command_modules/databoxedge/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/_params.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + + +def load_arguments(self, _): # pylint: disable=unused-argument + pass diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__cmd_group.py index 47bad23fdfd..06f75222332 100644 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__cmd_group.py +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__cmd_group.py @@ -3,6 +3,7 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # # Code generated by aaz-dev-tools +# swagger change: https://github.com/Azure/azure-rest-api-specs/pull/32901 # -------------------------------------------------------------------------------------------- # pylint: skip-file diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__init__.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__init__.py index 5a9d61963d6..48c85de46b8 100644 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__init__.py @@ -9,3 +9,6 @@ # flake8: noqa from .__cmd_group import * +from ._list_node import * +from ._list_sku import * +from ._show_job import * diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_list_node.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_list_node.py new file mode 100644 index 00000000000..ace32849d77 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_list_node.py @@ -0,0 +1,218 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge list-node", +) +class ListNode(AAZCommand): + """List all the nodes currently configured under this Data Box Edge device + + :example: Get all the nodes currently configured under this Data Box Edge device. + az databoxedge list-node --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/nodes", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NodesListByDataBoxEdgeDevice(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 NodesListByDataBoxEdgeDevice(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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={"read_only": 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.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True, "read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.node_chassis_serial_number = AAZStrType( + serialized_name="nodeChassisSerialNumber", + flags={"read_only": True}, + ) + properties.node_display_name = AAZStrType( + serialized_name="nodeDisplayName", + flags={"read_only": True}, + ) + properties.node_friendly_software_version = AAZStrType( + serialized_name="nodeFriendlySoftwareVersion", + flags={"read_only": True}, + ) + properties.node_hcs_version = AAZStrType( + serialized_name="nodeHcsVersion", + flags={"read_only": True}, + ) + properties.node_instance_id = AAZStrType( + serialized_name="nodeInstanceId", + flags={"read_only": True}, + ) + properties.node_serial_number = AAZStrType( + serialized_name="nodeSerialNumber", + flags={"read_only": True}, + ) + properties.node_status = AAZStrType( + serialized_name="nodeStatus", + flags={"read_only": True}, + ) + + return cls._schema_on_200 + + +class _ListNodeHelper: + """Helper class for ListNode""" + + +__all__ = ["ListNode"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_list_sku.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_list_sku.py new file mode 100644 index 00000000000..69e9d7433d9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_list_sku.py @@ -0,0 +1,265 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge list-sku", +) +class ListSku(AAZCommand): + """List all the available Skus and information related to them. + + :example: List all the available Skus in the region and information related to them. + az databoxedge list-sku + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.databoxedge/availableskus", "2021-02-01-preview"], + ] + } + + 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 "" + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AvailableSkusList(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 AvailableSkusList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/availableSkus", + **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", "2021-02-01-preview", + 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( + flags={"read_only": 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.availability = AAZStrType( + flags={"read_only": True}, + ) + _element.capabilities = AAZListType( + 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.shipment_types = AAZListType( + serialized_name="shipmentTypes", + flags={"read_only": True}, + ) + _element.signup_option = AAZStrType( + serialized_name="signupOption", + flags={"read_only": True}, + ) + _element.size = AAZStrType( + flags={"read_only": True}, + ) + _element.tier = AAZStrType( + flags={"read_only": True}, + ) + _element.version = 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() + + _element = cls._schema_on_200.value.Element.capabilities.Element + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.value = AAZStrType( + 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.sites = AAZListType( + flags={"read_only": True}, + ) + _element.zones = AAZListType( + flags={"read_only": True}, + ) + + sites = cls._schema_on_200.value.Element.location_info.Element.sites + sites.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() + + shipment_types = cls._schema_on_200.value.Element.shipment_types + shipment_types.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListSkuHelper: + """Helper class for ListSku""" + + +__all__ = ["ListSku"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_show_job.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_show_job.py new file mode 100644 index 00000000000..9b10db5c3e9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/_show_job.py @@ -0,0 +1,304 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge show-job", +) +class ShowJob(AAZCommand): + """Get the details of a specified job on a Data Box Edge/Data Box Gateway device. + + :example: Get the details of a specified job on a Data Box Edge/Data Box Gateway device. + az databoxedge show-job --device-name testedgedevice --name 12345678-1234-1234-1234-123456789012 --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/jobs/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The job name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.JobsGet(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 JobsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{name}", + **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( + "deviceName", self.ctx.args.device_name, + required=True, + ), + **self.serialize_url_param( + "name", 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", "2021-02-01-preview", + 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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.percent_complete = AAZIntType( + serialized_name="percentComplete", + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True, "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}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + error = cls._schema_on_200.error + error.code = AAZStrType( + flags={"read_only": True}, + ) + error.error_details = AAZListType( + serialized_name="errorDetails", + flags={"read_only": True}, + ) + error.message = AAZStrType( + flags={"read_only": True}, + ) + + error_details = cls._schema_on_200.error.error_details + error_details.Element = AAZObjectType() + + _element = cls._schema_on_200.error.error_details.Element + _element.code = AAZStrType( + flags={"read_only": True}, + ) + _element.message = AAZStrType( + flags={"read_only": True}, + ) + _element.recommendations = AAZListType( + flags={"read_only": True}, + ) + + recommendations = cls._schema_on_200.error.error_details.Element.recommendations + recommendations.Element = AAZStrType() + + properties = cls._schema_on_200.properties + properties.current_stage = AAZStrType( + serialized_name="currentStage", + flags={"read_only": True}, + ) + properties.download_progress = AAZObjectType( + serialized_name="downloadProgress", + flags={"read_only": True}, + ) + properties.error_manifest_file = AAZStrType( + serialized_name="errorManifestFile", + flags={"read_only": True}, + ) + properties.folder = AAZStrType() + properties.install_progress = AAZObjectType( + serialized_name="installProgress", + flags={"read_only": True}, + ) + properties.job_type = AAZStrType( + serialized_name="jobType", + flags={"read_only": True}, + ) + properties.refreshed_entity_id = AAZStrType( + serialized_name="refreshedEntityId", + flags={"read_only": True}, + ) + properties.total_refresh_errors = AAZIntType( + serialized_name="totalRefreshErrors", + flags={"read_only": True}, + ) + + download_progress = cls._schema_on_200.properties.download_progress + download_progress.download_phase = AAZStrType( + serialized_name="downloadPhase", + flags={"read_only": True}, + ) + download_progress.number_of_updates_downloaded = AAZIntType( + serialized_name="numberOfUpdatesDownloaded", + flags={"read_only": True}, + ) + download_progress.number_of_updates_to_download = AAZIntType( + serialized_name="numberOfUpdatesToDownload", + flags={"read_only": True}, + ) + download_progress.percent_complete = AAZIntType( + serialized_name="percentComplete", + flags={"read_only": True}, + ) + download_progress.total_bytes_downloaded = AAZFloatType( + serialized_name="totalBytesDownloaded", + flags={"read_only": True}, + ) + download_progress.total_bytes_to_download = AAZFloatType( + serialized_name="totalBytesToDownload", + flags={"read_only": True}, + ) + + install_progress = cls._schema_on_200.properties.install_progress + install_progress.number_of_updates_installed = AAZIntType( + serialized_name="numberOfUpdatesInstalled", + flags={"read_only": True}, + ) + install_progress.number_of_updates_to_install = AAZIntType( + serialized_name="numberOfUpdatesToInstall", + flags={"read_only": True}, + ) + install_progress.percent_complete = AAZIntType( + serialized_name="percentComplete", + flags={"read_only": True}, + ) + + return cls._schema_on_200 + + +class _ShowJobHelper: + """Helper class for ShowJob""" + + +__all__ = ["ShowJob"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/__cmd_group.py new file mode 100644 index 00000000000..7019b79cb06 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "databoxedge alert", +) +class __CMDGroup(AAZCommandGroup): + """Manage Alert + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_validators.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/__init__.py similarity index 52% rename from src/azure-cli/azure/cli/command_modules/databoxedge/generated/_validators.py rename to src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/__init__.py index b33a44c1ebf..2df85698253 100644 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/__init__.py @@ -1,9 +1,13 @@ -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# 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/databoxedge/aaz/latest/databoxedge/alert/_list.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/_list.py new file mode 100644 index 00000000000..224ba148b8c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/_list.py @@ -0,0 +1,256 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge alert list", +) +class List(AAZCommand): + """List all the alerts for a Data Box Edge/Data Box Gateway device. + + :example: Get all the alerts for a Data Box Edge/Data Box Gateway device. + az databoxedge alert list --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/alerts", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AlertsListByDataBoxEdgeDevice(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 AlertsListByDataBoxEdgeDevice(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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( + flags={"read_only": 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.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True, "read_only": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.alert_type = AAZStrType( + serialized_name="alertType", + flags={"read_only": True}, + ) + properties.appeared_at_date_time = AAZStrType( + serialized_name="appearedAtDateTime", + flags={"read_only": True}, + ) + properties.detailed_information = AAZDictType( + serialized_name="detailedInformation", + flags={"read_only": True}, + ) + properties.error_details = AAZObjectType( + serialized_name="errorDetails", + flags={"read_only": True}, + ) + properties.recommendation = AAZStrType( + flags={"read_only": True}, + ) + properties.severity = AAZStrType( + flags={"read_only": True}, + ) + properties.title = AAZStrType( + flags={"read_only": True}, + ) + + detailed_information = cls._schema_on_200.value.Element.properties.detailed_information + detailed_information.Element = AAZStrType() + + error_details = cls._schema_on_200.value.Element.properties.error_details + error_details.error_code = AAZStrType( + serialized_name="errorCode", + flags={"read_only": True}, + ) + error_details.error_message = AAZStrType( + serialized_name="errorMessage", + flags={"read_only": True}, + ) + error_details.occurrences = AAZIntType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/_show.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/_show.py new file mode 100644 index 00000000000..2df9f988f4c --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/alert/_show.py @@ -0,0 +1,253 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge alert show", +) +class Show(AAZCommand): + """Get an alert by name. + + :example: Get an alert by name. + az databoxedge alert show --device-name testedgedevice --name 12345678-1234-1234-1234-123456789012 --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/alerts/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The alert name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AlertsGet(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 AlertsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{name}", + **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( + "deviceName", self.ctx.args.device_name, + required=True, + ), + **self.serialize_url_param( + "name", 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", "2021-02-01-preview", + 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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True, "read_only": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.alert_type = AAZStrType( + serialized_name="alertType", + flags={"read_only": True}, + ) + properties.appeared_at_date_time = AAZStrType( + serialized_name="appearedAtDateTime", + flags={"read_only": True}, + ) + properties.detailed_information = AAZDictType( + serialized_name="detailedInformation", + flags={"read_only": True}, + ) + properties.error_details = AAZObjectType( + serialized_name="errorDetails", + flags={"read_only": True}, + ) + properties.recommendation = AAZStrType( + flags={"read_only": True}, + ) + properties.severity = AAZStrType( + flags={"read_only": True}, + ) + properties.title = AAZStrType( + flags={"read_only": True}, + ) + + detailed_information = cls._schema_on_200.properties.detailed_information + detailed_information.Element = AAZStrType() + + error_details = cls._schema_on_200.properties.error_details + error_details.error_code = AAZStrType( + serialized_name="errorCode", + flags={"read_only": True}, + ) + error_details.error_message = AAZStrType( + serialized_name="errorMessage", + flags={"read_only": True}, + ) + error_details.occurrences = AAZIntType( + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/__cmd_group.py new file mode 100644 index 00000000000..b7e9270947b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "databoxedge bandwidth-schedule", +) +class __CMDGroup(AAZCommandGroup): + """Manage Bandwidth Schedule + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/__init__.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the 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/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_create.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_create.py new file mode 100644 index 00000000000..7af527120d7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_create.py @@ -0,0 +1,297 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge bandwidth-schedule create", +) +class Create(AAZCommand): + """Create a bandwidth schedule. + + :example: Create a bandwidth schedule. + az databoxedge bandwidth-schedule create --name "bandwidth-1" --device-name "testedgedevice" --days "Sunday" "Monday" --rate-in-mbps 100 --start "0:0:0" --stop "13:59:0" --resource-group "GroupForEdgeAutomation" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/bandwidthschedules/{}", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + ) + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The bandwidth schedule name which needs to be added/updated.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.days = AAZListArg( + options=["--days"], + help="The days of the week when this schedule is applicable.", + required=True, + ) + _args_schema.rate_in_mbps = AAZIntArg( + options=["--rate-in-mbps"], + help="The bandwidth rate in Mbps.", + required=True, + ) + _args_schema.start = AAZStrArg( + options=["--start"], + help="The start time of the schedule in UTC.", + required=True, + ) + _args_schema.stop = AAZStrArg( + options=["--stop"], + help="The stop time of the schedule in UTC.", + required=True, + ) + + days = cls._args_schema.days + days.Element = AAZStrArg( + enum={"Friday": "Friday", "Monday": "Monday", "Saturday": "Saturday", "Sunday": "Sunday", "Thursday": "Thursday", "Tuesday": "Tuesday", "Wednesday": "Wednesday"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BandwidthSchedulesCreateOrUpdate(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 BandwidthSchedulesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}", + **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( + "deviceName", self.ctx.args.device_name, + required=True, + ), + **self.serialize_url_param( + "name", 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("days", AAZListType, ".days", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("rateInMbps", AAZIntType, ".rate_in_mbps", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("start", AAZStrType, ".start", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("stop", AAZStrType, ".stop", typ_kwargs={"flags": {"required": True}}) + + days = _builder.get(".properties.days") + if days is not None: + days.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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.days = AAZListType( + flags={"required": True}, + ) + properties.rate_in_mbps = AAZIntType( + serialized_name="rateInMbps", + flags={"required": True}, + ) + properties.start = AAZStrType( + flags={"required": True}, + ) + properties.stop = AAZStrType( + flags={"required": True}, + ) + + days = cls._schema_on_200.properties.days + days.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_delete.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_delete.py new file mode 100644 index 00000000000..bd0ddd90699 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_delete.py @@ -0,0 +1,173 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge bandwidth-schedule delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the specified bandwidth schedule. + + :example: Delete the specified bandwidth schedule. + az databoxedge bandwidth-schedule delete --device-name testedgedevice --name bandwidth-1 --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/bandwidthschedules/{}", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The bandwidth schedule name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BandwidthSchedulesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class BandwidthSchedulesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}", + **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( + "deviceName", self.ctx.args.device_name, + required=True, + ), + **self.serialize_url_param( + "name", 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", "2021-02-01-preview", + 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/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_list.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_list.py new file mode 100644 index 00000000000..d288831ac21 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_list.py @@ -0,0 +1,235 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge bandwidth-schedule list", +) +class List(AAZCommand): + """List all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. + + :example: Get all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. + az databoxedge bandwidth-schedule list --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/bandwidthschedules", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BandwidthSchedulesListByDataBoxEdgeDevice(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 BandwidthSchedulesListByDataBoxEdgeDevice(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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( + flags={"read_only": 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.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.days = AAZListType( + flags={"required": True}, + ) + properties.rate_in_mbps = AAZIntType( + serialized_name="rateInMbps", + flags={"required": True}, + ) + properties.start = AAZStrType( + flags={"required": True}, + ) + properties.stop = AAZStrType( + flags={"required": True}, + ) + + days = cls._schema_on_200.value.Element.properties.days + days.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_show.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_show.py new file mode 100644 index 00000000000..b69dbd7db75 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_show.py @@ -0,0 +1,232 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge bandwidth-schedule show", +) +class Show(AAZCommand): + """Get the properties of the specified bandwidth schedule. + + :example: Get the properties of the specified bandwidth schedule. + az databoxedge bandwidth-schedule show --device-name testedgedevice --name bandwidth-1 --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/bandwidthschedules/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The bandwidth schedule name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BandwidthSchedulesGet(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 BandwidthSchedulesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}", + **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( + "deviceName", self.ctx.args.device_name, + required=True, + ), + **self.serialize_url_param( + "name", 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", "2021-02-01-preview", + 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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.days = AAZListType( + flags={"required": True}, + ) + properties.rate_in_mbps = AAZIntType( + serialized_name="rateInMbps", + flags={"required": True}, + ) + properties.start = AAZStrType( + flags={"required": True}, + ) + properties.stop = AAZStrType( + flags={"required": True}, + ) + + days = cls._schema_on_200.properties.days + days.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_update.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_update.py new file mode 100644 index 00000000000..62621201fa0 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_update.py @@ -0,0 +1,442 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge bandwidth-schedule update", +) +class Update(AAZCommand): + """Update a bandwidth schedule. + + :example: Update a bandwidth schedule. + az databoxedge bandwidth-schedule update --name "bandwidth-1" --device-name "testedgedevice" --rate-in-mbps 150 --resource-group "GroupForEdgeAutomation" --start "0:0:0" --stop 12:00:00 --days Sunday + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/bandwidthschedules/{}", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The bandwidth schedule name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.days = AAZListArg( + options=["--days"], + help="The days of the week when this schedule is applicable.", + ) + _args_schema.rate_in_mbps = AAZIntArg( + options=["--rate-in-mbps"], + help="The bandwidth rate in Mbps.", + ) + _args_schema.start = AAZStrArg( + options=["--start"], + help="The start time of the schedule in UTC.", + ) + _args_schema.stop = AAZStrArg( + options=["--stop"], + help="The stop time of the schedule in UTC.", + ) + + days = cls._args_schema.days + days.Element = AAZStrArg( + nullable=True, + enum={"Friday": "Friday", "Monday": "Monday", "Saturday": "Saturday", "Sunday": "Sunday", "Thursday": "Thursday", "Tuesday": "Tuesday", "Wednesday": "Wednesday"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BandwidthSchedulesGet(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.BandwidthSchedulesCreateOrUpdate(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 BandwidthSchedulesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}", + **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( + "deviceName", self.ctx.args.device_name, + required=True, + ), + **self.serialize_url_param( + "name", 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", "2021-02-01-preview", + 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_bandwidth_schedule_read(cls._schema_on_200) + + return cls._schema_on_200 + + class BandwidthSchedulesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}", + **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( + "deviceName", self.ctx.args.device_name, + required=True, + ), + **self.serialize_url_param( + "name", 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + 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_bandwidth_schedule_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": {"required": True, "client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("days", AAZListType, ".days", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("rateInMbps", AAZIntType, ".rate_in_mbps", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("start", AAZStrType, ".start", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("stop", AAZStrType, ".stop", typ_kwargs={"flags": {"required": True}}) + + days = _builder.get(".properties.days") + if days is not None: + days.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_bandwidth_schedule_read = None + + @classmethod + def _build_schema_bandwidth_schedule_read(cls, _schema): + if cls._schema_bandwidth_schedule_read is not None: + _schema.id = cls._schema_bandwidth_schedule_read.id + _schema.name = cls._schema_bandwidth_schedule_read.name + _schema.properties = cls._schema_bandwidth_schedule_read.properties + _schema.provisioning_state = cls._schema_bandwidth_schedule_read.provisioning_state + _schema.system_data = cls._schema_bandwidth_schedule_read.system_data + _schema.type = cls._schema_bandwidth_schedule_read.type + return + + cls._schema_bandwidth_schedule_read = _schema_bandwidth_schedule_read = AAZObjectType() + + bandwidth_schedule_read = _schema_bandwidth_schedule_read + bandwidth_schedule_read.id = AAZStrType( + flags={"read_only": True}, + ) + bandwidth_schedule_read.name = AAZStrType( + flags={"read_only": True}, + ) + bandwidth_schedule_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + bandwidth_schedule_read.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + bandwidth_schedule_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + bandwidth_schedule_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_bandwidth_schedule_read.properties + properties.days = AAZListType( + flags={"required": True}, + ) + properties.rate_in_mbps = AAZIntType( + serialized_name="rateInMbps", + flags={"required": True}, + ) + properties.start = AAZStrType( + flags={"required": True}, + ) + properties.stop = AAZStrType( + flags={"required": True}, + ) + + days = _schema_bandwidth_schedule_read.properties.days + days.Element = AAZStrType() + + system_data = _schema_bandwidth_schedule_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_bandwidth_schedule_read.id + _schema.name = cls._schema_bandwidth_schedule_read.name + _schema.properties = cls._schema_bandwidth_schedule_read.properties + _schema.provisioning_state = cls._schema_bandwidth_schedule_read.provisioning_state + _schema.system_data = cls._schema_bandwidth_schedule_read.system_data + _schema.type = cls._schema_bandwidth_schedule_read.type + + +__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_wait.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_wait.py new file mode 100644 index 00000000000..930322430d3 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/bandwidth_schedule/_wait.py @@ -0,0 +1,228 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge bandwidth-schedule 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.databoxedge/databoxedgedevices/{}/bandwidthschedules/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.name = AAZStrArg( + options=["-n", "--name"], + help="The bandwidth schedule name.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BandwidthSchedulesGet(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 BandwidthSchedulesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}", + **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( + "deviceName", self.ctx.args.device_name, + required=True, + ), + **self.serialize_url_param( + "name", 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", "2021-02-01-preview", + 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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.days = AAZListType( + flags={"required": True}, + ) + properties.rate_in_mbps = AAZIntType( + serialized_name="rateInMbps", + flags={"required": True}, + ) + properties.start = AAZStrType( + flags={"required": True}, + ) + properties.stop = AAZStrType( + flags={"required": True}, + ) + + days = cls._schema_on_200.properties.days + days.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/__init__.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/__init__.py index d95aee06a01..91eaa411c88 100644 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/__init__.py +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/__init__.py @@ -9,4 +9,14 @@ # flake8: noqa from .__cmd_group import * +from ._create import * +from ._delete import * +from ._download_update import * from ._get_extended_information import * +from ._install_update import * +from ._list import * +from ._scan_for_update import * +from ._show import * +from ._show_update_summary import * +from ._update import * +from ._wait import * diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_create.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_create.py new file mode 100644 index 00000000000..7b3f3508317 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_create.py @@ -0,0 +1,434 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device create", +) +class Create(AAZCommand): + """Create a Data Box Edge/Data Box Gateway resource. + + :example: Create a Data Box Edge resource. + az databoxedge device create --location "eastus" --sku "Edge" --name "testedgedevice" --resource-group "GroupForEdgeAutomation" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.etag = AAZStrArg( + options=["--etag"], + help="The etag for the devices.", + ) + _args_schema.location = AAZResourceLocationArg( + help="The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed.", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.status = AAZStrArg( + options=["--status"], + help="The status of the Data Box Edge/Gateway device.", + enum={"Disconnected": "Disconnected", "Maintenance": "Maintenance", "NeedsAttention": "NeedsAttention", "Offline": "Offline", "Online": "Online", "PartiallyDisconnected": "PartiallyDisconnected", "ReadyToSetup": "ReadyToSetup"}, + ) + _args_schema.description = AAZStrArg( + options=["--description"], + help="The Description of the Data Box Edge/Gateway device.", + ) + _args_schema.friendly_name = AAZStrArg( + options=["--friendly-name"], + help="The Data Box Edge/Gateway device name.", + ) + _args_schema.model_description = AAZStrArg( + options=["--model-description"], + help="The description of the Data Box Edge/Gateway device model.", + ) + _args_schema.sku = AAZStrArg( + options=["--sku"], + help="SKU name.", + enum={"EP2_128_1T4_Mx1_W": "EP2_128_1T4_Mx1_W", "EP2_256_2T4_W": "EP2_256_2T4_W", "EP2_64_1VPU_W": "EP2_64_1VPU_W", "Edge": "Edge", "EdgeMR_Mini": "EdgeMR_Mini", "EdgePR_Base": "EdgePR_Base", "EdgePR_Base_UPS": "EdgePR_Base_UPS", "EdgeP_Base": "EdgeP_Base", "EdgeP_High": "EdgeP_High", "GPU": "GPU", "Gateway": "Gateway", "Management": "Management", "RCA_Large": "RCA_Large", "RCA_Small": "RCA_Small", "RDC": "RDC", "TCA_Large": "TCA_Large", "TCA_Small": "TCA_Small", "TDC": "TDC", "TEA_1Node": "TEA_1Node", "TEA_1Node_Heater": "TEA_1Node_Heater", "TEA_1Node_UPS": "TEA_1Node_UPS", "TEA_1Node_UPS_Heater": "TEA_1Node_UPS_Heater", "TEA_4Node_Heater": "TEA_4Node_Heater", "TEA_4Node_UPS_Heater": "TEA_4Node_UPS_Heater", "TMA": "TMA"}, + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + help="The list of tags that describe the device. These tags can be used to view and group this device (across resource groups).", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DevicesCreateOrUpdate(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 DevicesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("etag", AAZStrType, ".etag") + _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) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("dataBoxEdgeDeviceStatus", AAZStrType, ".status") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("friendlyName", AAZStrType, ".friendly_name") + properties.set_prop("modelDescription", AAZStrType, ".model_description") + + sku = _builder.get(".sku") + if sku is not None: + sku.set_prop("name", AAZStrType, ".sku") + + 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.etag = AAZStrType() + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _schema_on_200.kind = 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.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.sku = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": 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() + + properties = cls._schema_on_200.properties + properties.configured_role_types = AAZListType( + serialized_name="configuredRoleTypes", + flags={"read_only": True}, + ) + properties.culture = AAZStrType( + flags={"read_only": True}, + ) + properties.data_box_edge_device_status = AAZStrType( + serialized_name="dataBoxEdgeDeviceStatus", + ) + properties.description = AAZStrType() + properties.device_hcs_version = AAZStrType( + serialized_name="deviceHcsVersion", + flags={"read_only": True}, + ) + properties.device_local_capacity = AAZIntType( + serialized_name="deviceLocalCapacity", + flags={"read_only": True}, + ) + properties.device_model = AAZStrType( + serialized_name="deviceModel", + flags={"read_only": True}, + ) + properties.device_software_version = AAZStrType( + serialized_name="deviceSoftwareVersion", + flags={"read_only": True}, + ) + properties.device_type = AAZStrType( + serialized_name="deviceType", + flags={"read_only": True}, + ) + properties.edge_profile = AAZObjectType( + serialized_name="edgeProfile", + flags={"read_only": True}, + ) + properties.friendly_name = AAZStrType( + serialized_name="friendlyName", + ) + properties.model_description = AAZStrType( + serialized_name="modelDescription", + ) + properties.node_count = AAZIntType( + serialized_name="nodeCount", + flags={"read_only": True}, + ) + properties.resource_move_details = AAZObjectType( + serialized_name="resourceMoveDetails", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.time_zone = AAZStrType( + serialized_name="timeZone", + flags={"read_only": True}, + ) + + configured_role_types = cls._schema_on_200.properties.configured_role_types + configured_role_types.Element = AAZStrType() + + edge_profile = cls._schema_on_200.properties.edge_profile + edge_profile.subscription = AAZObjectType() + + subscription = cls._schema_on_200.properties.edge_profile.subscription + subscription.id = AAZStrType() + subscription.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + subscription.registration_date = AAZStrType( + serialized_name="registrationDate", + ) + subscription.registration_id = AAZStrType( + serialized_name="registrationId", + ) + subscription.state = AAZStrType() + subscription.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + + properties = cls._schema_on_200.properties.edge_profile.subscription.properties + properties.location_placement_id = AAZStrType( + serialized_name="locationPlacementId", + ) + properties.quota_id = AAZStrType( + serialized_name="quotaId", + ) + properties.registered_features = AAZListType( + serialized_name="registeredFeatures", + ) + properties.serialized_details = AAZStrType( + serialized_name="serializedDetails", + ) + properties.tenant_id = AAZStrType( + serialized_name="tenantId", + ) + + registered_features = cls._schema_on_200.properties.edge_profile.subscription.properties.registered_features + registered_features.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.edge_profile.subscription.properties.registered_features.Element + _element.name = AAZStrType() + _element.state = AAZStrType() + + resource_move_details = cls._schema_on_200.properties.resource_move_details + resource_move_details.operation_in_progress = AAZStrType( + serialized_name="operationInProgress", + ) + resource_move_details.operation_in_progress_lock_timeout_in_utc = AAZStrType( + serialized_name="operationInProgressLockTimeoutInUTC", + ) + + sku = cls._schema_on_200.sku + sku.name = AAZStrType() + sku.tier = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_delete.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_delete.py new file mode 100644 index 00000000000..f10e71444e7 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_delete.py @@ -0,0 +1,163 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the Data Box Edge/Data Box Gateway device. + + :example: Delete the Data Box Edge/Data Box Gateway device. + az databoxedge device delete --name "testedgedevice" --resource-group "GroupForEdgeAutomation" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + 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.DevicesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DevicesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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/databoxedge/aaz/latest/databoxedge/device/_download_update.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_download_update.py new file mode 100644 index 00000000000..d059c124d55 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_download_update.py @@ -0,0 +1,150 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device download-update", +) +class DownloadUpdate(AAZCommand): + """Downloads the updates on a Data Box Edge/Data Box Gateway device. + + :example: Download the updates on a Data Box Edge/Data Box Gateway device. + az databoxedge device download-update --name "testedgedevice" --resource-group "GroupForEdgeAutomation" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/downloadupdates", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + 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.DevicesDownloadUpdates(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DevicesDownloadUpdates(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _DownloadUpdateHelper: + """Helper class for DownloadUpdate""" + + +__all__ = ["DownloadUpdate"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_install_update.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_install_update.py new file mode 100644 index 00000000000..752a201c76e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_install_update.py @@ -0,0 +1,150 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device install-update", +) +class InstallUpdate(AAZCommand): + """Installs the updates on the Data Box Edge/Data Box Gateway device. + + :example: Install the updates on the Data Box Edge/Data Box Gateway device. + az databoxedge device install-update --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/installupdates", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + 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.DevicesInstallUpdates(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DevicesInstallUpdates(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _InstallUpdateHelper: + """Helper class for InstallUpdate""" + + +__all__ = ["InstallUpdate"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_list.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_list.py new file mode 100644 index 00000000000..147fa5b6f8a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_list.py @@ -0,0 +1,635 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device list", +) +class List(AAZCommand): + """List all the Data Box Edge/Data Box Gateway devices in a subscription. + + :example: Get all the Data Box Edge/Data Box Gateway devices in a resource group. + az databoxedge device list --resource-group "GroupForEdgeAutomation" + + :example: Get all the Data Box Edge/Data Box Gateway devices in a subscription. + az databoxedge device list + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.databoxedge/databoxedgedevices", "2021-02-01-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices", "2021-02-01-preview"], + ] + } + + 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="Specify $expand=details to populate additional fields related to the resource or Specify $skipToken=token to populate the next page in the list.", + ) + 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.DevicesListBySubscription(ctx=self.ctx)() + if condition_1: + self.DevicesListByResourceGroup(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 DevicesListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices", + **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( + "api-version", "2021-02-01-preview", + 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( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType() + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZObjectType() + _element.kind = 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.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _element.sku = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": 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() + + properties = cls._schema_on_200.value.Element.properties + properties.configured_role_types = AAZListType( + serialized_name="configuredRoleTypes", + flags={"read_only": True}, + ) + properties.culture = AAZStrType( + flags={"read_only": True}, + ) + properties.data_box_edge_device_status = AAZStrType( + serialized_name="dataBoxEdgeDeviceStatus", + ) + properties.description = AAZStrType() + properties.device_hcs_version = AAZStrType( + serialized_name="deviceHcsVersion", + flags={"read_only": True}, + ) + properties.device_local_capacity = AAZIntType( + serialized_name="deviceLocalCapacity", + flags={"read_only": True}, + ) + properties.device_model = AAZStrType( + serialized_name="deviceModel", + flags={"read_only": True}, + ) + properties.device_software_version = AAZStrType( + serialized_name="deviceSoftwareVersion", + flags={"read_only": True}, + ) + properties.device_type = AAZStrType( + serialized_name="deviceType", + flags={"read_only": True}, + ) + properties.edge_profile = AAZObjectType( + serialized_name="edgeProfile", + flags={"read_only": True}, + ) + properties.friendly_name = AAZStrType( + serialized_name="friendlyName", + ) + properties.model_description = AAZStrType( + serialized_name="modelDescription", + ) + properties.node_count = AAZIntType( + serialized_name="nodeCount", + flags={"read_only": True}, + ) + properties.resource_move_details = AAZObjectType( + serialized_name="resourceMoveDetails", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.time_zone = AAZStrType( + serialized_name="timeZone", + flags={"read_only": True}, + ) + + configured_role_types = cls._schema_on_200.value.Element.properties.configured_role_types + configured_role_types.Element = AAZStrType() + + edge_profile = cls._schema_on_200.value.Element.properties.edge_profile + edge_profile.subscription = AAZObjectType() + + subscription = cls._schema_on_200.value.Element.properties.edge_profile.subscription + subscription.id = AAZStrType() + subscription.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + subscription.registration_date = AAZStrType( + serialized_name="registrationDate", + ) + subscription.registration_id = AAZStrType( + serialized_name="registrationId", + ) + subscription.state = AAZStrType() + subscription.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + + properties = cls._schema_on_200.value.Element.properties.edge_profile.subscription.properties + properties.location_placement_id = AAZStrType( + serialized_name="locationPlacementId", + ) + properties.quota_id = AAZStrType( + serialized_name="quotaId", + ) + properties.registered_features = AAZListType( + serialized_name="registeredFeatures", + ) + properties.serialized_details = AAZStrType( + serialized_name="serializedDetails", + ) + properties.tenant_id = AAZStrType( + serialized_name="tenantId", + ) + + registered_features = cls._schema_on_200.value.Element.properties.edge_profile.subscription.properties.registered_features + registered_features.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.edge_profile.subscription.properties.registered_features.Element + _element.name = AAZStrType() + _element.state = AAZStrType() + + resource_move_details = cls._schema_on_200.value.Element.properties.resource_move_details + resource_move_details.operation_in_progress = AAZStrType( + serialized_name="operationInProgress", + ) + resource_move_details.operation_in_progress_lock_timeout_in_utc = AAZStrType( + serialized_name="operationInProgressLockTimeoutInUTC", + ) + + sku = cls._schema_on_200.value.Element.sku + sku.name = AAZStrType() + sku.tier = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class DevicesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices", + **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", "2021-02-01-preview", + 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( + flags={"read_only": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType() + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.identity = AAZObjectType() + _element.kind = 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.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _element.sku = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": 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() + + properties = cls._schema_on_200.value.Element.properties + properties.configured_role_types = AAZListType( + serialized_name="configuredRoleTypes", + flags={"read_only": True}, + ) + properties.culture = AAZStrType( + flags={"read_only": True}, + ) + properties.data_box_edge_device_status = AAZStrType( + serialized_name="dataBoxEdgeDeviceStatus", + ) + properties.description = AAZStrType() + properties.device_hcs_version = AAZStrType( + serialized_name="deviceHcsVersion", + flags={"read_only": True}, + ) + properties.device_local_capacity = AAZIntType( + serialized_name="deviceLocalCapacity", + flags={"read_only": True}, + ) + properties.device_model = AAZStrType( + serialized_name="deviceModel", + flags={"read_only": True}, + ) + properties.device_software_version = AAZStrType( + serialized_name="deviceSoftwareVersion", + flags={"read_only": True}, + ) + properties.device_type = AAZStrType( + serialized_name="deviceType", + flags={"read_only": True}, + ) + properties.edge_profile = AAZObjectType( + serialized_name="edgeProfile", + flags={"read_only": True}, + ) + properties.friendly_name = AAZStrType( + serialized_name="friendlyName", + ) + properties.model_description = AAZStrType( + serialized_name="modelDescription", + ) + properties.node_count = AAZIntType( + serialized_name="nodeCount", + flags={"read_only": True}, + ) + properties.resource_move_details = AAZObjectType( + serialized_name="resourceMoveDetails", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.time_zone = AAZStrType( + serialized_name="timeZone", + flags={"read_only": True}, + ) + + configured_role_types = cls._schema_on_200.value.Element.properties.configured_role_types + configured_role_types.Element = AAZStrType() + + edge_profile = cls._schema_on_200.value.Element.properties.edge_profile + edge_profile.subscription = AAZObjectType() + + subscription = cls._schema_on_200.value.Element.properties.edge_profile.subscription + subscription.id = AAZStrType() + subscription.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + subscription.registration_date = AAZStrType( + serialized_name="registrationDate", + ) + subscription.registration_id = AAZStrType( + serialized_name="registrationId", + ) + subscription.state = AAZStrType() + subscription.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + + properties = cls._schema_on_200.value.Element.properties.edge_profile.subscription.properties + properties.location_placement_id = AAZStrType( + serialized_name="locationPlacementId", + ) + properties.quota_id = AAZStrType( + serialized_name="quotaId", + ) + properties.registered_features = AAZListType( + serialized_name="registeredFeatures", + ) + properties.serialized_details = AAZStrType( + serialized_name="serializedDetails", + ) + properties.tenant_id = AAZStrType( + serialized_name="tenantId", + ) + + registered_features = cls._schema_on_200.value.Element.properties.edge_profile.subscription.properties.registered_features + registered_features.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.edge_profile.subscription.properties.registered_features.Element + _element.name = AAZStrType() + _element.state = AAZStrType() + + resource_move_details = cls._schema_on_200.value.Element.properties.resource_move_details + resource_move_details.operation_in_progress = AAZStrType( + serialized_name="operationInProgress", + ) + resource_move_details.operation_in_progress_lock_timeout_in_utc = AAZStrType( + serialized_name="operationInProgressLockTimeoutInUTC", + ) + + sku = cls._schema_on_200.value.Element.sku + sku.name = AAZStrType() + sku.tier = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + 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/databoxedge/aaz/latest/databoxedge/device/_scan_for_update.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_scan_for_update.py new file mode 100644 index 00000000000..6d829b1322a --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_scan_for_update.py @@ -0,0 +1,150 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device scan-for-update", +) +class ScanForUpdate(AAZCommand): + """Scans for updates on a Data Box Edge/Data Box Gateway device. + + :example: Scan for updates on a Data Box Edge/Data Box Gateway device. + az databoxedge device scan-for-update --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/scanforupdates", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + 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.DevicesScanForUpdates(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DevicesScanForUpdates(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + +class _ScanForUpdateHelper: + """Helper class for ScanForUpdate""" + + +__all__ = ["ScanForUpdate"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_show.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_show.py new file mode 100644 index 00000000000..55ce0b8025f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_show.py @@ -0,0 +1,345 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device show", +) +class Show(AAZCommand): + """Get the properties of the Data Box Edge/Data Box Gateway device. + + :example: Get the properties of the Data Box Edge/Data Box Gateway device. + az databoxedge device show --name "testedgedevice" --resource-group "GroupForEdgeAutomation" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DevicesGet(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 DevicesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _schema_on_200.kind = 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.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.sku = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": 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() + + properties = cls._schema_on_200.properties + properties.configured_role_types = AAZListType( + serialized_name="configuredRoleTypes", + flags={"read_only": True}, + ) + properties.culture = AAZStrType( + flags={"read_only": True}, + ) + properties.data_box_edge_device_status = AAZStrType( + serialized_name="dataBoxEdgeDeviceStatus", + ) + properties.description = AAZStrType() + properties.device_hcs_version = AAZStrType( + serialized_name="deviceHcsVersion", + flags={"read_only": True}, + ) + properties.device_local_capacity = AAZIntType( + serialized_name="deviceLocalCapacity", + flags={"read_only": True}, + ) + properties.device_model = AAZStrType( + serialized_name="deviceModel", + flags={"read_only": True}, + ) + properties.device_software_version = AAZStrType( + serialized_name="deviceSoftwareVersion", + flags={"read_only": True}, + ) + properties.device_type = AAZStrType( + serialized_name="deviceType", + flags={"read_only": True}, + ) + properties.edge_profile = AAZObjectType( + serialized_name="edgeProfile", + flags={"read_only": True}, + ) + properties.friendly_name = AAZStrType( + serialized_name="friendlyName", + ) + properties.model_description = AAZStrType( + serialized_name="modelDescription", + ) + properties.node_count = AAZIntType( + serialized_name="nodeCount", + flags={"read_only": True}, + ) + properties.resource_move_details = AAZObjectType( + serialized_name="resourceMoveDetails", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.time_zone = AAZStrType( + serialized_name="timeZone", + flags={"read_only": True}, + ) + + configured_role_types = cls._schema_on_200.properties.configured_role_types + configured_role_types.Element = AAZStrType() + + edge_profile = cls._schema_on_200.properties.edge_profile + edge_profile.subscription = AAZObjectType() + + subscription = cls._schema_on_200.properties.edge_profile.subscription + subscription.id = AAZStrType() + subscription.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + subscription.registration_date = AAZStrType( + serialized_name="registrationDate", + ) + subscription.registration_id = AAZStrType( + serialized_name="registrationId", + ) + subscription.state = AAZStrType() + subscription.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + + properties = cls._schema_on_200.properties.edge_profile.subscription.properties + properties.location_placement_id = AAZStrType( + serialized_name="locationPlacementId", + ) + properties.quota_id = AAZStrType( + serialized_name="quotaId", + ) + properties.registered_features = AAZListType( + serialized_name="registeredFeatures", + ) + properties.serialized_details = AAZStrType( + serialized_name="serializedDetails", + ) + properties.tenant_id = AAZStrType( + serialized_name="tenantId", + ) + + registered_features = cls._schema_on_200.properties.edge_profile.subscription.properties.registered_features + registered_features.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.edge_profile.subscription.properties.registered_features.Element + _element.name = AAZStrType() + _element.state = AAZStrType() + + resource_move_details = cls._schema_on_200.properties.resource_move_details + resource_move_details.operation_in_progress = AAZStrType( + serialized_name="operationInProgress", + ) + resource_move_details.operation_in_progress_lock_timeout_in_utc = AAZStrType( + serialized_name="operationInProgressLockTimeoutInUTC", + ) + + sku = cls._schema_on_200.sku + sku.name = AAZStrType() + sku.tier = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + 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/databoxedge/aaz/latest/databoxedge/device/_show_update_summary.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_show_update_summary.py new file mode 100644 index 00000000000..f61acb0c4e9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_show_update_summary.py @@ -0,0 +1,316 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device show-update-summary", +) +class ShowUpdateSummary(AAZCommand): + """Get information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. + + :example: Get update summary of the device. + az databoxedge device show-update-summary --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/updatesummary/default", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DevicesGetUpdateSummary(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 DevicesGetUpdateSummary(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.device_last_scanned_date_time = AAZStrType( + serialized_name="deviceLastScannedDateTime", + ) + properties.device_version_number = AAZStrType( + serialized_name="deviceVersionNumber", + ) + properties.friendly_device_version_name = AAZStrType( + serialized_name="friendlyDeviceVersionName", + ) + properties.in_progress_download_job_id = AAZStrType( + serialized_name="inProgressDownloadJobId", + flags={"read_only": True}, + ) + properties.in_progress_download_job_started_date_time = AAZStrType( + serialized_name="inProgressDownloadJobStartedDateTime", + flags={"read_only": True}, + ) + properties.in_progress_install_job_id = AAZStrType( + serialized_name="inProgressInstallJobId", + flags={"read_only": True}, + ) + properties.in_progress_install_job_started_date_time = AAZStrType( + serialized_name="inProgressInstallJobStartedDateTime", + flags={"read_only": True}, + ) + properties.last_completed_download_job_date_time = AAZStrType( + serialized_name="lastCompletedDownloadJobDateTime", + flags={"read_only": True}, + ) + properties.last_completed_download_job_id = AAZStrType( + serialized_name="lastCompletedDownloadJobId", + flags={"read_only": True}, + ) + properties.last_completed_install_job_date_time = AAZStrType( + serialized_name="lastCompletedInstallJobDateTime", + flags={"read_only": True}, + ) + properties.last_completed_install_job_id = AAZStrType( + serialized_name="lastCompletedInstallJobId", + flags={"read_only": True}, + ) + properties.last_completed_scan_job_date_time = AAZStrType( + serialized_name="lastCompletedScanJobDateTime", + ) + properties.last_download_job_status = AAZStrType( + serialized_name="lastDownloadJobStatus", + flags={"read_only": True}, + ) + properties.last_install_job_status = AAZStrType( + serialized_name="lastInstallJobStatus", + flags={"read_only": True}, + ) + properties.ongoing_update_operation = AAZStrType( + serialized_name="ongoingUpdateOperation", + flags={"read_only": True}, + ) + properties.reboot_behavior = AAZStrType( + serialized_name="rebootBehavior", + flags={"read_only": True}, + ) + properties.total_number_of_updates_available = AAZIntType( + serialized_name="totalNumberOfUpdatesAvailable", + flags={"read_only": True}, + ) + properties.total_number_of_updates_pending_download = AAZIntType( + serialized_name="totalNumberOfUpdatesPendingDownload", + flags={"read_only": True}, + ) + properties.total_number_of_updates_pending_install = AAZIntType( + serialized_name="totalNumberOfUpdatesPendingInstall", + flags={"read_only": True}, + ) + properties.total_time_in_minutes = AAZIntType( + serialized_name="totalTimeInMinutes", + flags={"read_only": True}, + ) + properties.total_update_size_in_bytes = AAZFloatType( + serialized_name="totalUpdateSizeInBytes", + flags={"read_only": True}, + ) + properties.update_titles = AAZListType( + serialized_name="updateTitles", + flags={"read_only": True}, + ) + properties.updates = AAZListType( + flags={"read_only": True}, + ) + + update_titles = cls._schema_on_200.properties.update_titles + update_titles.Element = AAZStrType() + + updates = cls._schema_on_200.properties.updates + updates.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.updates.Element + _element.estimated_install_time_in_mins = AAZIntType( + serialized_name="estimatedInstallTimeInMins", + ) + _element.reboot_behavior = AAZStrType( + serialized_name="rebootBehavior", + ) + _element.status = AAZStrType() + _element.target_version = AAZStrType( + serialized_name="targetVersion", + ) + _element.update_size = AAZFloatType( + serialized_name="updateSize", + ) + _element.update_title = AAZStrType( + serialized_name="updateTitle", + ) + _element.update_type = AAZStrType( + serialized_name="updateType", + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowUpdateSummaryHelper: + """Helper class for ShowUpdateSummary""" + + +__all__ = ["ShowUpdateSummary"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_update.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_update.py new file mode 100644 index 00000000000..b18a375d040 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_update.py @@ -0,0 +1,375 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device update", +) +class Update(AAZCommand): + """Update a Data Box Edge/Data Box Gateway resource. + + :example: Modify a Data Box Edge/Data Box Gateway resource. + az databoxedge device update --name "testedgedevice" --tags Key1="value1" Key2="value2" --resource-group "GroupForEdgeAutomation" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + help="The tags attached to the Data Box Edge/Gateway resource.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Parameters" + + # define Arg Group "Properties" + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DevicesUpdate(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 DevicesUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "deviceName", self.ctx.args.device_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-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("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(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @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( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _schema_on_200.kind = 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.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.sku = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": 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() + + properties = cls._schema_on_200.properties + properties.configured_role_types = AAZListType( + serialized_name="configuredRoleTypes", + flags={"read_only": True}, + ) + properties.culture = AAZStrType( + flags={"read_only": True}, + ) + properties.data_box_edge_device_status = AAZStrType( + serialized_name="dataBoxEdgeDeviceStatus", + ) + properties.description = AAZStrType() + properties.device_hcs_version = AAZStrType( + serialized_name="deviceHcsVersion", + flags={"read_only": True}, + ) + properties.device_local_capacity = AAZIntType( + serialized_name="deviceLocalCapacity", + flags={"read_only": True}, + ) + properties.device_model = AAZStrType( + serialized_name="deviceModel", + flags={"read_only": True}, + ) + properties.device_software_version = AAZStrType( + serialized_name="deviceSoftwareVersion", + flags={"read_only": True}, + ) + properties.device_type = AAZStrType( + serialized_name="deviceType", + flags={"read_only": True}, + ) + properties.edge_profile = AAZObjectType( + serialized_name="edgeProfile", + flags={"read_only": True}, + ) + properties.friendly_name = AAZStrType( + serialized_name="friendlyName", + ) + properties.model_description = AAZStrType( + serialized_name="modelDescription", + ) + properties.node_count = AAZIntType( + serialized_name="nodeCount", + flags={"read_only": True}, + ) + properties.resource_move_details = AAZObjectType( + serialized_name="resourceMoveDetails", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.time_zone = AAZStrType( + serialized_name="timeZone", + flags={"read_only": True}, + ) + + configured_role_types = cls._schema_on_200.properties.configured_role_types + configured_role_types.Element = AAZStrType() + + edge_profile = cls._schema_on_200.properties.edge_profile + edge_profile.subscription = AAZObjectType() + + subscription = cls._schema_on_200.properties.edge_profile.subscription + subscription.id = AAZStrType() + subscription.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + subscription.registration_date = AAZStrType( + serialized_name="registrationDate", + ) + subscription.registration_id = AAZStrType( + serialized_name="registrationId", + ) + subscription.state = AAZStrType() + subscription.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + + properties = cls._schema_on_200.properties.edge_profile.subscription.properties + properties.location_placement_id = AAZStrType( + serialized_name="locationPlacementId", + ) + properties.quota_id = AAZStrType( + serialized_name="quotaId", + ) + properties.registered_features = AAZListType( + serialized_name="registeredFeatures", + ) + properties.serialized_details = AAZStrType( + serialized_name="serializedDetails", + ) + properties.tenant_id = AAZStrType( + serialized_name="tenantId", + ) + + registered_features = cls._schema_on_200.properties.edge_profile.subscription.properties.registered_features + registered_features.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.edge_profile.subscription.properties.registered_features.Element + _element.name = AAZStrType() + _element.state = AAZStrType() + + resource_move_details = cls._schema_on_200.properties.resource_move_details + resource_move_details.operation_in_progress = AAZStrType( + serialized_name="operationInProgress", + ) + resource_move_details.operation_in_progress_lock_timeout_in_utc = AAZStrType( + serialized_name="operationInProgressLockTimeoutInUTC", + ) + + sku = cls._schema_on_200.sku + sku.name = AAZStrType() + sku.tier = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_wait.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_wait.py new file mode 100644 index 00000000000..bd3bfb65aac --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/device/_wait.py @@ -0,0 +1,341 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge device 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.databoxedge/databoxedgedevices/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-n", "--name", "--device-name"], + help="The device name.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DevicesGet(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 DevicesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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( + flags={"read_only": True}, + ) + _schema_on_200.identity = AAZObjectType() + _schema_on_200.kind = 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.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.sku = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": 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() + + properties = cls._schema_on_200.properties + properties.configured_role_types = AAZListType( + serialized_name="configuredRoleTypes", + flags={"read_only": True}, + ) + properties.culture = AAZStrType( + flags={"read_only": True}, + ) + properties.data_box_edge_device_status = AAZStrType( + serialized_name="dataBoxEdgeDeviceStatus", + ) + properties.description = AAZStrType() + properties.device_hcs_version = AAZStrType( + serialized_name="deviceHcsVersion", + flags={"read_only": True}, + ) + properties.device_local_capacity = AAZIntType( + serialized_name="deviceLocalCapacity", + flags={"read_only": True}, + ) + properties.device_model = AAZStrType( + serialized_name="deviceModel", + flags={"read_only": True}, + ) + properties.device_software_version = AAZStrType( + serialized_name="deviceSoftwareVersion", + flags={"read_only": True}, + ) + properties.device_type = AAZStrType( + serialized_name="deviceType", + flags={"read_only": True}, + ) + properties.edge_profile = AAZObjectType( + serialized_name="edgeProfile", + flags={"read_only": True}, + ) + properties.friendly_name = AAZStrType( + serialized_name="friendlyName", + ) + properties.model_description = AAZStrType( + serialized_name="modelDescription", + ) + properties.node_count = AAZIntType( + serialized_name="nodeCount", + flags={"read_only": True}, + ) + properties.resource_move_details = AAZObjectType( + serialized_name="resourceMoveDetails", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.time_zone = AAZStrType( + serialized_name="timeZone", + flags={"read_only": True}, + ) + + configured_role_types = cls._schema_on_200.properties.configured_role_types + configured_role_types.Element = AAZStrType() + + edge_profile = cls._schema_on_200.properties.edge_profile + edge_profile.subscription = AAZObjectType() + + subscription = cls._schema_on_200.properties.edge_profile.subscription + subscription.id = AAZStrType() + subscription.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + subscription.registration_date = AAZStrType( + serialized_name="registrationDate", + ) + subscription.registration_id = AAZStrType( + serialized_name="registrationId", + ) + subscription.state = AAZStrType() + subscription.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + + properties = cls._schema_on_200.properties.edge_profile.subscription.properties + properties.location_placement_id = AAZStrType( + serialized_name="locationPlacementId", + ) + properties.quota_id = AAZStrType( + serialized_name="quotaId", + ) + properties.registered_features = AAZListType( + serialized_name="registeredFeatures", + ) + properties.serialized_details = AAZStrType( + serialized_name="serializedDetails", + ) + properties.tenant_id = AAZStrType( + serialized_name="tenantId", + ) + + registered_features = cls._schema_on_200.properties.edge_profile.subscription.properties.registered_features + registered_features.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.edge_profile.subscription.properties.registered_features.Element + _element.name = AAZStrType() + _element.state = AAZStrType() + + resource_move_details = cls._schema_on_200.properties.resource_move_details + resource_move_details.operation_in_progress = AAZStrType( + serialized_name="operationInProgress", + ) + resource_move_details.operation_in_progress_lock_timeout_in_utc = AAZStrType( + serialized_name="operationInProgressLockTimeoutInUTC", + ) + + sku = cls._schema_on_200.sku + sku.name = AAZStrType() + sku.tier = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + 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/databoxedge/aaz/latest/databoxedge/order/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/__cmd_group.py new file mode 100644 index 00000000000..ff2cddc2527 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "databoxedge order", +) +class __CMDGroup(AAZCommandGroup): + """Manage order with databoxedge + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/__init__.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the 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/databoxedge/aaz/latest/databoxedge/order/_create.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_create.py new file mode 100644 index 00000000000..eb95e280dac --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_create.py @@ -0,0 +1,508 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge order create", +) +class Create(AAZCommand): + """Create an order. + + :example: Create an order. + az databoxedge order create --device-name testedgedevice --contact-person John Mcclane --company-name Microsoft --phone (800) 426-9400 --email-list "john@microsoft.com" --address-line1 Microsoft Corporation --address-line2 One Microsoft Way --address-line3 Redmond --postal-code 98052 --city WA --state WA --country USA --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/orders/default", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The order details of a device.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ContactInformation" + + _args_schema = cls._args_schema + _args_schema.company_name = AAZStrArg( + options=["--company-name"], + arg_group="ContactInformation", + help="The name of the company.", + ) + _args_schema.contact_person = AAZStrArg( + options=["--contact-person"], + arg_group="ContactInformation", + help="The contact person name.", + ) + _args_schema.email_list = AAZListArg( + options=["--email-list"], + arg_group="ContactInformation", + help="The email list.", + ) + _args_schema.phone = AAZStrArg( + options=["--phone"], + arg_group="ContactInformation", + help="The phone number.", + ) + + email_list = cls._args_schema.email_list + email_list.Element = AAZStrArg() + + # define Arg Group "CurrentStatus" + + _args_schema = cls._args_schema + _args_schema.comments = AAZStrArg( + options=["--comments"], + arg_group="CurrentStatus", + help="Comments related to this status change.", + ) + _args_schema.status = AAZStrArg( + options=["--status"], + arg_group="CurrentStatus", + help="Status of the order as per the allowed status types.", + enum={"Arriving": "Arriving", "AwaitingDrop": "AwaitingDrop", "AwaitingFulfillment": "AwaitingFulfillment", "AwaitingPickup": "AwaitingPickup", "AwaitingPreparation": "AwaitingPreparation", "AwaitingReturnShipment": "AwaitingReturnShipment", "AwaitingShipment": "AwaitingShipment", "CollectedAtMicrosoft": "CollectedAtMicrosoft", "Declined": "Declined", "Delivered": "Delivered", "LostDevice": "LostDevice", "PickupCompleted": "PickupCompleted", "ReplacementRequested": "ReplacementRequested", "ReturnInitiated": "ReturnInitiated", "Shipped": "Shipped", "ShippedBack": "ShippedBack", "Untracked": "Untracked"}, + ) + + # define Arg Group "Properties" + + # define Arg Group "ShippingAddress" + + _args_schema = cls._args_schema + _args_schema.address_line1 = AAZStrArg( + options=["--address-line1"], + arg_group="ShippingAddress", + help="The address line1.", + ) + _args_schema.address_line2 = AAZStrArg( + options=["--address-line2"], + arg_group="ShippingAddress", + help="The address line2.", + ) + _args_schema.address_line3 = AAZStrArg( + options=["--address-line3"], + arg_group="ShippingAddress", + help="The address line3.", + ) + _args_schema.city = AAZStrArg( + options=["--city"], + arg_group="ShippingAddress", + help="The city name.", + ) + _args_schema.country = AAZStrArg( + options=["--country"], + arg_group="ShippingAddress", + help="The country name.", + ) + _args_schema.postal_code = AAZStrArg( + options=["--postal-code"], + arg_group="ShippingAddress", + help="The postal code.", + ) + _args_schema.state = AAZStrArg( + options=["--state"], + arg_group="ShippingAddress", + help="The state name.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.OrdersCreateOrUpdate(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 OrdersCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("contactInformation", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("currentStatus", AAZObjectType) + properties.set_prop("shippingAddress", AAZObjectType) + + contact_information = _builder.get(".properties.contactInformation") + if contact_information is not None: + contact_information.set_prop("companyName", AAZStrType, ".company_name", typ_kwargs={"flags": {"required": True}}) + contact_information.set_prop("contactPerson", AAZStrType, ".contact_person", typ_kwargs={"flags": {"required": True}}) + contact_information.set_prop("emailList", AAZListType, ".email_list", typ_kwargs={"flags": {"required": True}}) + contact_information.set_prop("phone", AAZStrType, ".phone", typ_kwargs={"flags": {"required": True}}) + + email_list = _builder.get(".properties.contactInformation.emailList") + if email_list is not None: + email_list.set_elements(AAZStrType, ".") + + current_status = _builder.get(".properties.currentStatus") + if current_status is not None: + current_status.set_prop("comments", AAZStrType, ".comments") + current_status.set_prop("status", AAZStrType, ".status", typ_kwargs={"flags": {"required": True}}) + + shipping_address = _builder.get(".properties.shippingAddress") + if shipping_address is not None: + shipping_address.set_prop("addressLine1", AAZStrType, ".address_line1") + shipping_address.set_prop("addressLine2", AAZStrType, ".address_line2") + shipping_address.set_prop("addressLine3", AAZStrType, ".address_line3") + shipping_address.set_prop("city", AAZStrType, ".city") + shipping_address.set_prop("country", AAZStrType, ".country", typ_kwargs={"flags": {"required": True}}) + shipping_address.set_prop("postalCode", AAZStrType, ".postal_code") + shipping_address.set_prop("state", AAZStrType, ".state") + + 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.id = AAZStrType( + 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.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.contact_information = AAZObjectType( + serialized_name="contactInformation", + flags={"required": True}, + ) + properties.current_status = AAZObjectType( + serialized_name="currentStatus", + ) + _CreateHelper._build_schema_order_status_read(properties.current_status) + properties.delivery_tracking_info = AAZListType( + serialized_name="deliveryTrackingInfo", + flags={"read_only": True}, + ) + properties.order_history = AAZListType( + serialized_name="orderHistory", + flags={"read_only": True}, + ) + properties.return_tracking_info = AAZListType( + serialized_name="returnTrackingInfo", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.shipment_type = AAZStrType( + serialized_name="shipmentType", + ) + properties.shipping_address = AAZObjectType( + serialized_name="shippingAddress", + ) + + contact_information = cls._schema_on_200.properties.contact_information + contact_information.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + contact_information.contact_person = AAZStrType( + serialized_name="contactPerson", + flags={"required": True}, + ) + contact_information.email_list = AAZListType( + serialized_name="emailList", + flags={"required": True}, + ) + contact_information.phone = AAZStrType( + flags={"required": True}, + ) + + email_list = cls._schema_on_200.properties.contact_information.email_list + email_list.Element = AAZStrType() + + delivery_tracking_info = cls._schema_on_200.properties.delivery_tracking_info + delivery_tracking_info.Element = AAZObjectType() + _CreateHelper._build_schema_tracking_info_read(delivery_tracking_info.Element) + + order_history = cls._schema_on_200.properties.order_history + order_history.Element = AAZObjectType() + _CreateHelper._build_schema_order_status_read(order_history.Element) + + return_tracking_info = cls._schema_on_200.properties.return_tracking_info + return_tracking_info.Element = AAZObjectType() + _CreateHelper._build_schema_tracking_info_read(return_tracking_info.Element) + + shipping_address = cls._schema_on_200.properties.shipping_address + shipping_address.address_line1 = AAZStrType( + serialized_name="addressLine1", + ) + shipping_address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + shipping_address.address_line3 = AAZStrType( + serialized_name="addressLine3", + ) + shipping_address.city = AAZStrType() + shipping_address.country = AAZStrType( + flags={"required": True}, + ) + shipping_address.postal_code = AAZStrType( + serialized_name="postalCode", + ) + shipping_address.state = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _CreateHelper: + """Helper class for Create""" + + _schema_order_status_read = None + + @classmethod + def _build_schema_order_status_read(cls, _schema): + if cls._schema_order_status_read is not None: + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + return + + cls._schema_order_status_read = _schema_order_status_read = AAZObjectType() + + order_status_read = _schema_order_status_read + order_status_read.additional_order_details = AAZDictType( + serialized_name="additionalOrderDetails", + flags={"read_only": True}, + ) + order_status_read.comments = AAZStrType() + order_status_read.status = AAZStrType( + flags={"required": True}, + ) + order_status_read.tracking_information = AAZObjectType( + serialized_name="trackingInformation", + flags={"read_only": True}, + ) + cls._build_schema_tracking_info_read(order_status_read.tracking_information) + order_status_read.update_date_time = AAZStrType( + serialized_name="updateDateTime", + flags={"read_only": True}, + ) + + additional_order_details = _schema_order_status_read.additional_order_details + additional_order_details.Element = AAZStrType() + + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + + _schema_tracking_info_read = None + + @classmethod + def _build_schema_tracking_info_read(cls, _schema): + if cls._schema_tracking_info_read is not None: + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + return + + cls._schema_tracking_info_read = _schema_tracking_info_read = AAZObjectType( + flags={"read_only": True} + ) + + tracking_info_read = _schema_tracking_info_read + tracking_info_read.carrier_name = AAZStrType( + serialized_name="carrierName", + ) + tracking_info_read.serial_number = AAZStrType( + serialized_name="serialNumber", + ) + tracking_info_read.tracking_id = AAZStrType( + serialized_name="trackingId", + ) + tracking_info_read.tracking_url = AAZStrType( + serialized_name="trackingUrl", + ) + + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + + +__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_delete.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_delete.py new file mode 100644 index 00000000000..c761642c75f --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_delete.py @@ -0,0 +1,163 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge order delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the order related to the device. + + :example: Delete the order related to the device. + az databoxedge order delete --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/orders/default", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The order details of a device.", + 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.OrdersDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class OrdersDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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/databoxedge/aaz/latest/databoxedge/order/_list.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_list.py new file mode 100644 index 00000000000..cfcafd31d91 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_list.py @@ -0,0 +1,376 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge order list", +) +class List(AAZCommand): + """List all the orders related to a Data Box Edge/Data Box Gateway device. + + :example: List all the orders related to a Data Box Edge/Data Box Gateway device. + az databoxedge order list --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/orders", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The order details of a device.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrdersListByDataBoxEdgeDevice(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 OrdersListByDataBoxEdgeDevice(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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( + flags={"read_only": 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.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.contact_information = AAZObjectType( + serialized_name="contactInformation", + flags={"required": True}, + ) + properties.current_status = AAZObjectType( + serialized_name="currentStatus", + ) + _ListHelper._build_schema_order_status_read(properties.current_status) + properties.delivery_tracking_info = AAZListType( + serialized_name="deliveryTrackingInfo", + flags={"read_only": True}, + ) + properties.order_history = AAZListType( + serialized_name="orderHistory", + flags={"read_only": True}, + ) + properties.return_tracking_info = AAZListType( + serialized_name="returnTrackingInfo", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.shipment_type = AAZStrType( + serialized_name="shipmentType", + ) + properties.shipping_address = AAZObjectType( + serialized_name="shippingAddress", + ) + + contact_information = cls._schema_on_200.value.Element.properties.contact_information + contact_information.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + contact_information.contact_person = AAZStrType( + serialized_name="contactPerson", + flags={"required": True}, + ) + contact_information.email_list = AAZListType( + serialized_name="emailList", + flags={"required": True}, + ) + contact_information.phone = AAZStrType( + flags={"required": True}, + ) + + email_list = cls._schema_on_200.value.Element.properties.contact_information.email_list + email_list.Element = AAZStrType() + + delivery_tracking_info = cls._schema_on_200.value.Element.properties.delivery_tracking_info + delivery_tracking_info.Element = AAZObjectType() + _ListHelper._build_schema_tracking_info_read(delivery_tracking_info.Element) + + order_history = cls._schema_on_200.value.Element.properties.order_history + order_history.Element = AAZObjectType() + _ListHelper._build_schema_order_status_read(order_history.Element) + + return_tracking_info = cls._schema_on_200.value.Element.properties.return_tracking_info + return_tracking_info.Element = AAZObjectType() + _ListHelper._build_schema_tracking_info_read(return_tracking_info.Element) + + shipping_address = cls._schema_on_200.value.Element.properties.shipping_address + shipping_address.address_line1 = AAZStrType( + serialized_name="addressLine1", + ) + shipping_address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + shipping_address.address_line3 = AAZStrType( + serialized_name="addressLine3", + ) + shipping_address.city = AAZStrType() + shipping_address.country = AAZStrType( + flags={"required": True}, + ) + shipping_address.postal_code = AAZStrType( + serialized_name="postalCode", + ) + shipping_address.state = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_order_status_read = None + + @classmethod + def _build_schema_order_status_read(cls, _schema): + if cls._schema_order_status_read is not None: + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + return + + cls._schema_order_status_read = _schema_order_status_read = AAZObjectType() + + order_status_read = _schema_order_status_read + order_status_read.additional_order_details = AAZDictType( + serialized_name="additionalOrderDetails", + flags={"read_only": True}, + ) + order_status_read.comments = AAZStrType() + order_status_read.status = AAZStrType( + flags={"required": True}, + ) + order_status_read.tracking_information = AAZObjectType( + serialized_name="trackingInformation", + flags={"read_only": True}, + ) + cls._build_schema_tracking_info_read(order_status_read.tracking_information) + order_status_read.update_date_time = AAZStrType( + serialized_name="updateDateTime", + flags={"read_only": True}, + ) + + additional_order_details = _schema_order_status_read.additional_order_details + additional_order_details.Element = AAZStrType() + + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + + _schema_tracking_info_read = None + + @classmethod + def _build_schema_tracking_info_read(cls, _schema): + if cls._schema_tracking_info_read is not None: + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + return + + cls._schema_tracking_info_read = _schema_tracking_info_read = AAZObjectType( + flags={"read_only": True} + ) + + tracking_info_read = _schema_tracking_info_read + tracking_info_read.carrier_name = AAZStrType( + serialized_name="carrierName", + ) + tracking_info_read.serial_number = AAZStrType( + serialized_name="serialNumber", + ) + tracking_info_read.tracking_id = AAZStrType( + serialized_name="trackingId", + ) + tracking_info_read.tracking_url = AAZStrType( + serialized_name="trackingUrl", + ) + + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_show.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_show.py new file mode 100644 index 00000000000..e96d0881dcb --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_show.py @@ -0,0 +1,363 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge order show", +) +class Show(AAZCommand): + """Get a specific order by name. + + :example: Get a specific order by name. + az databoxedge order show --device-name testedgedevice --resource-group GroupForEdgeAutomation + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/orders/default", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The order details of a device.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrdersGet(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 OrdersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.contact_information = AAZObjectType( + serialized_name="contactInformation", + flags={"required": True}, + ) + properties.current_status = AAZObjectType( + serialized_name="currentStatus", + ) + _ShowHelper._build_schema_order_status_read(properties.current_status) + properties.delivery_tracking_info = AAZListType( + serialized_name="deliveryTrackingInfo", + flags={"read_only": True}, + ) + properties.order_history = AAZListType( + serialized_name="orderHistory", + flags={"read_only": True}, + ) + properties.return_tracking_info = AAZListType( + serialized_name="returnTrackingInfo", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.shipment_type = AAZStrType( + serialized_name="shipmentType", + ) + properties.shipping_address = AAZObjectType( + serialized_name="shippingAddress", + ) + + contact_information = cls._schema_on_200.properties.contact_information + contact_information.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + contact_information.contact_person = AAZStrType( + serialized_name="contactPerson", + flags={"required": True}, + ) + contact_information.email_list = AAZListType( + serialized_name="emailList", + flags={"required": True}, + ) + contact_information.phone = AAZStrType( + flags={"required": True}, + ) + + email_list = cls._schema_on_200.properties.contact_information.email_list + email_list.Element = AAZStrType() + + delivery_tracking_info = cls._schema_on_200.properties.delivery_tracking_info + delivery_tracking_info.Element = AAZObjectType() + _ShowHelper._build_schema_tracking_info_read(delivery_tracking_info.Element) + + order_history = cls._schema_on_200.properties.order_history + order_history.Element = AAZObjectType() + _ShowHelper._build_schema_order_status_read(order_history.Element) + + return_tracking_info = cls._schema_on_200.properties.return_tracking_info + return_tracking_info.Element = AAZObjectType() + _ShowHelper._build_schema_tracking_info_read(return_tracking_info.Element) + + shipping_address = cls._schema_on_200.properties.shipping_address + shipping_address.address_line1 = AAZStrType( + serialized_name="addressLine1", + ) + shipping_address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + shipping_address.address_line3 = AAZStrType( + serialized_name="addressLine3", + ) + shipping_address.city = AAZStrType() + shipping_address.country = AAZStrType( + flags={"required": True}, + ) + shipping_address.postal_code = AAZStrType( + serialized_name="postalCode", + ) + shipping_address.state = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_order_status_read = None + + @classmethod + def _build_schema_order_status_read(cls, _schema): + if cls._schema_order_status_read is not None: + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + return + + cls._schema_order_status_read = _schema_order_status_read = AAZObjectType() + + order_status_read = _schema_order_status_read + order_status_read.additional_order_details = AAZDictType( + serialized_name="additionalOrderDetails", + flags={"read_only": True}, + ) + order_status_read.comments = AAZStrType() + order_status_read.status = AAZStrType( + flags={"required": True}, + ) + order_status_read.tracking_information = AAZObjectType( + serialized_name="trackingInformation", + flags={"read_only": True}, + ) + cls._build_schema_tracking_info_read(order_status_read.tracking_information) + order_status_read.update_date_time = AAZStrType( + serialized_name="updateDateTime", + flags={"read_only": True}, + ) + + additional_order_details = _schema_order_status_read.additional_order_details + additional_order_details.Element = AAZStrType() + + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + + _schema_tracking_info_read = None + + @classmethod + def _build_schema_tracking_info_read(cls, _schema): + if cls._schema_tracking_info_read is not None: + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + return + + cls._schema_tracking_info_read = _schema_tracking_info_read = AAZObjectType( + flags={"read_only": True} + ) + + tracking_info_read = _schema_tracking_info_read + tracking_info_read.carrier_name = AAZStrType( + serialized_name="carrierName", + ) + tracking_info_read.serial_number = AAZStrType( + serialized_name="serialNumber", + ) + tracking_info_read.tracking_id = AAZStrType( + serialized_name="trackingId", + ) + tracking_info_read.tracking_url = AAZStrType( + serialized_name="trackingUrl", + ) + + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_update.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_update.py new file mode 100644 index 00000000000..ec24c90a356 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_update.py @@ -0,0 +1,660 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge order update", +) +class Update(AAZCommand): + """Update an order. + + :example: Update an order + az databoxedge order update --phone "(800) 426-9432" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/orders/default", "2021-02-01-preview"], + ] + } + + 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.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The order details of a device.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ContactInformation" + + _args_schema = cls._args_schema + _args_schema.company_name = AAZStrArg( + options=["--company-name"], + arg_group="ContactInformation", + help="The name of the company.", + ) + _args_schema.contact_person = AAZStrArg( + options=["--contact-person"], + arg_group="ContactInformation", + help="The contact person name.", + ) + _args_schema.email_list = AAZListArg( + options=["--email-list"], + arg_group="ContactInformation", + help="The email list.", + ) + _args_schema.phone = AAZStrArg( + options=["--phone"], + arg_group="ContactInformation", + help="The phone number.", + ) + + email_list = cls._args_schema.email_list + email_list.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "CurrentStatus" + + _args_schema = cls._args_schema + _args_schema.comments = AAZStrArg( + options=["--comments"], + arg_group="CurrentStatus", + help="Comments related to this status change.", + nullable=True, + ) + _args_schema.status = AAZStrArg( + options=["--status"], + arg_group="CurrentStatus", + help="Status of the order as per the allowed status types.", + enum={"Arriving": "Arriving", "AwaitingDrop": "AwaitingDrop", "AwaitingFulfillment": "AwaitingFulfillment", "AwaitingPickup": "AwaitingPickup", "AwaitingPreparation": "AwaitingPreparation", "AwaitingReturnShipment": "AwaitingReturnShipment", "AwaitingShipment": "AwaitingShipment", "CollectedAtMicrosoft": "CollectedAtMicrosoft", "Declined": "Declined", "Delivered": "Delivered", "LostDevice": "LostDevice", "PickupCompleted": "PickupCompleted", "ReplacementRequested": "ReplacementRequested", "ReturnInitiated": "ReturnInitiated", "Shipped": "Shipped", "ShippedBack": "ShippedBack", "Untracked": "Untracked"}, + ) + + # define Arg Group "Properties" + + # define Arg Group "ShippingAddress" + + _args_schema = cls._args_schema + _args_schema.address_line1 = AAZStrArg( + options=["--address-line1"], + arg_group="ShippingAddress", + help="The address line1.", + nullable=True, + ) + _args_schema.address_line2 = AAZStrArg( + options=["--address-line2"], + arg_group="ShippingAddress", + help="The address line2.", + nullable=True, + ) + _args_schema.address_line3 = AAZStrArg( + options=["--address-line3"], + arg_group="ShippingAddress", + help="The address line3.", + nullable=True, + ) + _args_schema.city = AAZStrArg( + options=["--city"], + arg_group="ShippingAddress", + help="The city name.", + nullable=True, + ) + _args_schema.country = AAZStrArg( + options=["--country"], + arg_group="ShippingAddress", + help="The country name.", + ) + _args_schema.postal_code = AAZStrArg( + options=["--postal-code"], + arg_group="ShippingAddress", + help="The postal code.", + nullable=True, + ) + _args_schema.state = AAZStrArg( + options=["--state"], + arg_group="ShippingAddress", + help="The state name.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrdersGet(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.OrdersCreateOrUpdate(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 OrdersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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_order_read(cls._schema_on_200) + + return cls._schema_on_200 + + class OrdersCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + 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_order_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}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("contactInformation", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("currentStatus", AAZObjectType) + properties.set_prop("shippingAddress", AAZObjectType) + + contact_information = _builder.get(".properties.contactInformation") + if contact_information is not None: + contact_information.set_prop("companyName", AAZStrType, ".company_name", typ_kwargs={"flags": {"required": True}}) + contact_information.set_prop("contactPerson", AAZStrType, ".contact_person", typ_kwargs={"flags": {"required": True}}) + contact_information.set_prop("emailList", AAZListType, ".email_list", typ_kwargs={"flags": {"required": True}}) + contact_information.set_prop("phone", AAZStrType, ".phone", typ_kwargs={"flags": {"required": True}}) + + email_list = _builder.get(".properties.contactInformation.emailList") + if email_list is not None: + email_list.set_elements(AAZStrType, ".") + + current_status = _builder.get(".properties.currentStatus") + if current_status is not None: + current_status.set_prop("comments", AAZStrType, ".comments") + current_status.set_prop("status", AAZStrType, ".status", typ_kwargs={"flags": {"required": True}}) + + shipping_address = _builder.get(".properties.shippingAddress") + if shipping_address is not None: + shipping_address.set_prop("addressLine1", AAZStrType, ".address_line1") + shipping_address.set_prop("addressLine2", AAZStrType, ".address_line2") + shipping_address.set_prop("addressLine3", AAZStrType, ".address_line3") + shipping_address.set_prop("city", AAZStrType, ".city") + shipping_address.set_prop("country", AAZStrType, ".country", typ_kwargs={"flags": {"required": True}}) + shipping_address.set_prop("postalCode", AAZStrType, ".postal_code") + shipping_address.set_prop("state", AAZStrType, ".state") + + 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_order_status_read = None + + @classmethod + def _build_schema_order_status_read(cls, _schema): + if cls._schema_order_status_read is not None: + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + return + + cls._schema_order_status_read = _schema_order_status_read = AAZObjectType() + + order_status_read = _schema_order_status_read + order_status_read.additional_order_details = AAZDictType( + serialized_name="additionalOrderDetails", + flags={"read_only": True}, + ) + order_status_read.comments = AAZStrType() + order_status_read.status = AAZStrType( + flags={"required": True}, + ) + order_status_read.tracking_information = AAZObjectType( + serialized_name="trackingInformation", + flags={"read_only": True}, + ) + cls._build_schema_tracking_info_read(order_status_read.tracking_information) + order_status_read.update_date_time = AAZStrType( + serialized_name="updateDateTime", + flags={"read_only": True}, + ) + + additional_order_details = _schema_order_status_read.additional_order_details + additional_order_details.Element = AAZStrType() + + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + + _schema_order_read = None + + @classmethod + def _build_schema_order_read(cls, _schema): + if cls._schema_order_read is not None: + _schema.id = cls._schema_order_read.id + _schema.name = cls._schema_order_read.name + _schema.properties = cls._schema_order_read.properties + _schema.provisioning_state = cls._schema_order_read.provisioning_state + _schema.system_data = cls._schema_order_read.system_data + _schema.type = cls._schema_order_read.type + return + + cls._schema_order_read = _schema_order_read = AAZObjectType() + + order_read = _schema_order_read + order_read.id = AAZStrType( + flags={"read_only": True}, + ) + order_read.name = AAZStrType( + flags={"read_only": True}, + ) + order_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + order_read.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + order_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + order_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_order_read.properties + properties.contact_information = AAZObjectType( + serialized_name="contactInformation", + flags={"required": True}, + ) + properties.current_status = AAZObjectType( + serialized_name="currentStatus", + ) + cls._build_schema_order_status_read(properties.current_status) + properties.delivery_tracking_info = AAZListType( + serialized_name="deliveryTrackingInfo", + flags={"read_only": True}, + ) + properties.order_history = AAZListType( + serialized_name="orderHistory", + flags={"read_only": True}, + ) + properties.return_tracking_info = AAZListType( + serialized_name="returnTrackingInfo", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.shipment_type = AAZStrType( + serialized_name="shipmentType", + ) + properties.shipping_address = AAZObjectType( + serialized_name="shippingAddress", + ) + + contact_information = _schema_order_read.properties.contact_information + contact_information.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + contact_information.contact_person = AAZStrType( + serialized_name="contactPerson", + flags={"required": True}, + ) + contact_information.email_list = AAZListType( + serialized_name="emailList", + flags={"required": True}, + ) + contact_information.phone = AAZStrType( + flags={"required": True}, + ) + + email_list = _schema_order_read.properties.contact_information.email_list + email_list.Element = AAZStrType() + + delivery_tracking_info = _schema_order_read.properties.delivery_tracking_info + delivery_tracking_info.Element = AAZObjectType() + cls._build_schema_tracking_info_read(delivery_tracking_info.Element) + + order_history = _schema_order_read.properties.order_history + order_history.Element = AAZObjectType() + cls._build_schema_order_status_read(order_history.Element) + + return_tracking_info = _schema_order_read.properties.return_tracking_info + return_tracking_info.Element = AAZObjectType() + cls._build_schema_tracking_info_read(return_tracking_info.Element) + + shipping_address = _schema_order_read.properties.shipping_address + shipping_address.address_line1 = AAZStrType( + serialized_name="addressLine1", + ) + shipping_address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + shipping_address.address_line3 = AAZStrType( + serialized_name="addressLine3", + ) + shipping_address.city = AAZStrType() + shipping_address.country = AAZStrType( + flags={"required": True}, + ) + shipping_address.postal_code = AAZStrType( + serialized_name="postalCode", + ) + shipping_address.state = AAZStrType() + + system_data = _schema_order_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_order_read.id + _schema.name = cls._schema_order_read.name + _schema.properties = cls._schema_order_read.properties + _schema.provisioning_state = cls._schema_order_read.provisioning_state + _schema.system_data = cls._schema_order_read.system_data + _schema.type = cls._schema_order_read.type + + _schema_tracking_info_read = None + + @classmethod + def _build_schema_tracking_info_read(cls, _schema): + if cls._schema_tracking_info_read is not None: + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + return + + cls._schema_tracking_info_read = _schema_tracking_info_read = AAZObjectType( + flags={"read_only": True} + ) + + tracking_info_read = _schema_tracking_info_read + tracking_info_read.carrier_name = AAZStrType( + serialized_name="carrierName", + ) + tracking_info_read.serial_number = AAZStrType( + serialized_name="serialNumber", + ) + tracking_info_read.tracking_id = AAZStrType( + serialized_name="trackingId", + ) + tracking_info_read.tracking_url = AAZStrType( + serialized_name="trackingUrl", + ) + + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + + +__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_wait.py b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_wait.py new file mode 100644 index 00000000000..2874ab2672e --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/order/_wait.py @@ -0,0 +1,359 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "databoxedge order 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.databoxedge/databoxedgedevices/{}/orders/default", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.device_name = AAZStrArg( + options=["-d", "--device-name"], + help="The order details of a device.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.OrdersGet(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 OrdersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default", + **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( + "deviceName", self.ctx.args.device_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-02-01-preview", + 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.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.contact_information = AAZObjectType( + serialized_name="contactInformation", + flags={"required": True}, + ) + properties.current_status = AAZObjectType( + serialized_name="currentStatus", + ) + _WaitHelper._build_schema_order_status_read(properties.current_status) + properties.delivery_tracking_info = AAZListType( + serialized_name="deliveryTrackingInfo", + flags={"read_only": True}, + ) + properties.order_history = AAZListType( + serialized_name="orderHistory", + flags={"read_only": True}, + ) + properties.return_tracking_info = AAZListType( + serialized_name="returnTrackingInfo", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.shipment_type = AAZStrType( + serialized_name="shipmentType", + ) + properties.shipping_address = AAZObjectType( + serialized_name="shippingAddress", + ) + + contact_information = cls._schema_on_200.properties.contact_information + contact_information.company_name = AAZStrType( + serialized_name="companyName", + flags={"required": True}, + ) + contact_information.contact_person = AAZStrType( + serialized_name="contactPerson", + flags={"required": True}, + ) + contact_information.email_list = AAZListType( + serialized_name="emailList", + flags={"required": True}, + ) + contact_information.phone = AAZStrType( + flags={"required": True}, + ) + + email_list = cls._schema_on_200.properties.contact_information.email_list + email_list.Element = AAZStrType() + + delivery_tracking_info = cls._schema_on_200.properties.delivery_tracking_info + delivery_tracking_info.Element = AAZObjectType() + _WaitHelper._build_schema_tracking_info_read(delivery_tracking_info.Element) + + order_history = cls._schema_on_200.properties.order_history + order_history.Element = AAZObjectType() + _WaitHelper._build_schema_order_status_read(order_history.Element) + + return_tracking_info = cls._schema_on_200.properties.return_tracking_info + return_tracking_info.Element = AAZObjectType() + _WaitHelper._build_schema_tracking_info_read(return_tracking_info.Element) + + shipping_address = cls._schema_on_200.properties.shipping_address + shipping_address.address_line1 = AAZStrType( + serialized_name="addressLine1", + ) + shipping_address.address_line2 = AAZStrType( + serialized_name="addressLine2", + ) + shipping_address.address_line3 = AAZStrType( + serialized_name="addressLine3", + ) + shipping_address.city = AAZStrType() + shipping_address.country = AAZStrType( + flags={"required": True}, + ) + shipping_address.postal_code = AAZStrType( + serialized_name="postalCode", + ) + shipping_address.state = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + _schema_order_status_read = None + + @classmethod + def _build_schema_order_status_read(cls, _schema): + if cls._schema_order_status_read is not None: + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + return + + cls._schema_order_status_read = _schema_order_status_read = AAZObjectType() + + order_status_read = _schema_order_status_read + order_status_read.additional_order_details = AAZDictType( + serialized_name="additionalOrderDetails", + flags={"read_only": True}, + ) + order_status_read.comments = AAZStrType() + order_status_read.status = AAZStrType( + flags={"required": True}, + ) + order_status_read.tracking_information = AAZObjectType( + serialized_name="trackingInformation", + flags={"read_only": True}, + ) + cls._build_schema_tracking_info_read(order_status_read.tracking_information) + order_status_read.update_date_time = AAZStrType( + serialized_name="updateDateTime", + flags={"read_only": True}, + ) + + additional_order_details = _schema_order_status_read.additional_order_details + additional_order_details.Element = AAZStrType() + + _schema.additional_order_details = cls._schema_order_status_read.additional_order_details + _schema.comments = cls._schema_order_status_read.comments + _schema.status = cls._schema_order_status_read.status + _schema.tracking_information = cls._schema_order_status_read.tracking_information + _schema.update_date_time = cls._schema_order_status_read.update_date_time + + _schema_tracking_info_read = None + + @classmethod + def _build_schema_tracking_info_read(cls, _schema): + if cls._schema_tracking_info_read is not None: + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + return + + cls._schema_tracking_info_read = _schema_tracking_info_read = AAZObjectType( + flags={"read_only": True} + ) + + tracking_info_read = _schema_tracking_info_read + tracking_info_read.carrier_name = AAZStrType( + serialized_name="carrierName", + ) + tracking_info_read.serial_number = AAZStrType( + serialized_name="serialNumber", + ) + tracking_info_read.tracking_id = AAZStrType( + serialized_name="trackingId", + ) + tracking_info_read.tracking_url = AAZStrType( + serialized_name="trackingUrl", + ) + + _schema.carrier_name = cls._schema_tracking_info_read.carrier_name + _schema.serial_number = cls._schema_tracking_info_read.serial_number + _schema.tracking_id = cls._schema_tracking_info_read.tracking_id + _schema.tracking_url = cls._schema_tracking_info_read.tracking_url + + +__all__ = ["Wait"] diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/action.py b/src/azure-cli/azure/cli/command_modules/databoxedge/action.py deleted file mode 100644 index d95d53bf711..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/action.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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wildcard-import -# pylint: disable=unused-wildcard-import - -from .generated.action import * # noqa: F403 -try: - from .manual.action import * # noqa: F403 -except ImportError: - pass diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/commands.py b/src/azure-cli/azure/cli/command_modules/databoxedge/commands.py new file mode 100644 index 00000000000..1a64c2516da --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/commands.py @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +# from azure.cli.core.commands import CliCommandType +# from azure.cli.core.profiles import ResourceType + + +def load_command_table(self, _): # pylint: disable=unused-argument + with self.command_group('databoxedge order'): + from .custom import OrderCreate + self.command_table['databoxedge order create'] = OrderCreate(loader=self) diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/custom.py b/src/azure-cli/azure/cli/command_modules/databoxedge/custom.py index dbe9d5f9742..7e5518e080c 100644 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/custom.py +++ b/src/azure-cli/azure/cli/command_modules/databoxedge/custom.py @@ -1,17 +1,33 @@ -# -------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. # -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wildcard-import -# pylint: disable=unused-wildcard-import +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- -from .generated.custom import * # noqa: F403 -try: - from .manual.custom import * # noqa: F403 -except ImportError: - pass +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements, protected-access + +from knack.log import get_logger + +from .aaz.latest.databoxedge.order import Create as _OrderCreate + + +logger = get_logger(__name__) + + +class OrderCreate(_OrderCreate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + schema = super()._build_arguments_schema(*args, **kwargs) + schema.company_name._required = True + schema.contact_person._required = True + schema.email_list._required = True + schema.phone._required = True + schema.status._required = True + schema.address_line1._required = True + schema.city._required = True + schema.country._required = True + schema.postal_code._required = True + schema.state._required = True + return schema diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/__init__.py b/src/azure-cli/azure/cli/command_modules/databoxedge/generated/__init__.py deleted file mode 100644 index c9cfdc73e77..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_client_factory.py b/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_client_factory.py deleted file mode 100644 index 7756e7fffcd..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_client_factory.py +++ /dev/null @@ -1,44 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - - -def cf_databoxedge_cl(cli_ctx, *_): - from azure.cli.core.commands.client_factory import get_mgmt_service_client - from azure.cli.core.profiles import ResourceType - return get_mgmt_service_client(cli_ctx, - ResourceType.MGMT_DATABOXEDGE) - - -def cf_device(cli_ctx, *_): - return cf_databoxedge_cl(cli_ctx).devices - - -def cf_alert(cli_ctx, *_): - return cf_databoxedge_cl(cli_ctx).alerts - - -def cf_bandwidth_schedule(cli_ctx, *_): - return cf_databoxedge_cl(cli_ctx).bandwidth_schedules - - -def cf_job(cli_ctx, *_): - return cf_databoxedge_cl(cli_ctx).jobs - - -def cf_node(cli_ctx, *_): - return cf_databoxedge_cl(cli_ctx).nodes - - -def cf_order(cli_ctx, *_): - return cf_databoxedge_cl(cli_ctx).orders - - -def cf_sku(cli_ctx, *_): - return cf_databoxedge_cl(cli_ctx).skus diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_help.py b/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_help.py deleted file mode 100644 index 9979a486e17..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_help.py +++ /dev/null @@ -1,332 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-lines - -from knack.help_files import helps - - -helps['databoxedge device'] = """ - type: group - short-summary: Manage device with databoxedge -""" - -helps['databoxedge device list'] = """ - type: command - short-summary: "Gets all the Data Box Edge/Data Box Gateway devices in a resource group. And Gets all the Data Box \ -Edge/Data Box Gateway devices in a subscription." - examples: - - name: DataBoxEdgeDeviceGetByResourceGroup - text: |- - az databoxedge device list --resource-group "GroupForEdgeAutomation" - - name: DataBoxEdgeDeviceGetBySubscription - text: |- - az databoxedge device list -""" - -helps['databoxedge device show'] = """ - type: command - short-summary: "Gets the properties of the Data Box Edge/Data Box Gateway device." - examples: - - name: DataBoxEdgeDeviceGetByName - text: |- - az databoxedge device show --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device create'] = """ - type: command - short-summary: "Create a Data Box Edge/Data Box Gateway resource." - parameters: - - name: --sku - short-summary: "The SKU type." - long-summary: | - Usage: --sku name=XX tier=XX - - name: SKU name. - tier: The SKU tier. This is based on the SKU name. - examples: - - name: DataBoxEdgeDevicePut - text: |- - az databoxedge device create --location "eastus" --sku name="Edge" tier="Standard" --name \ -"testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device update'] = """ - type: command - short-summary: "Modifies a Data Box Edge/Data Box Gateway resource." - examples: - - name: DataBoxEdgeDevicePatch - text: |- - az databoxedge device update --name "testedgedevice" --tags Key1="value1" Key2="value2" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device delete'] = """ - type: command - short-summary: "Deletes the Data Box Edge/Data Box Gateway device." - examples: - - name: DataBoxEdgeDeviceDelete - text: |- - az databoxedge device delete --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device download-update'] = """ - type: command - short-summary: "Downloads the updates on a Data Box Edge/Data Box Gateway device." - examples: - - name: DownloadUpdatesPost - text: |- - az databoxedge device download-update --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device install-update'] = """ - type: command - short-summary: "Installs the updates on the Data Box Edge/Data Box Gateway device." - examples: - - name: InstallUpdatesPost - text: |- - az databoxedge device install-update --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device scan-for-update'] = """ - type: command - short-summary: "Scans for updates on a Data Box Edge/Data Box Gateway device." - examples: - - name: ScanForUpdatesPost - text: |- - az databoxedge device scan-for-update --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device show-update-summary'] = """ - type: command - short-summary: "Gets information about the availability of updates based on the last scan of the device. It also \ -gets information about any ongoing download or install jobs on the device." - examples: - - name: UpdateSummaryGet - text: |- - az databoxedge device show-update-summary --name "testedgedevice" --resource-group \ -"GroupForEdgeAutomation" -""" - -helps['databoxedge device wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the databoxedge device is met. - examples: - - name: Pause executing next line of CLI script until the databoxedge device is successfully created. - text: |- - az databoxedge device wait --name "testedgedevice" --resource-group "GroupForEdgeAutomation" --created - - name: Pause executing next line of CLI script until the databoxedge device is successfully deleted. - text: |- - az databoxedge device wait --name "testedgedevice" --resource-group "GroupForEdgeAutomation" --deleted -""" - -helps['databoxedge alert'] = """ - type: group - short-summary: Manage alert with databoxedge -""" - -helps['databoxedge alert list'] = """ - type: command - short-summary: "Gets all the alerts for a Data Box Edge/Data Box Gateway device." - examples: - - name: AlertGetAllInDevice - text: |- - az databoxedge alert list --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge alert show'] = """ - type: command - short-summary: "Gets an alert by name." - examples: - - name: AlertGet - text: |- - az databoxedge alert show --name "159a00c7-8543-4343-9435-263ac87df3bb" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule'] = """ - type: group - short-summary: Manage bandwidth schedule with databoxedge -""" - -helps['databoxedge bandwidth-schedule list'] = """ - type: command - short-summary: "Gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device." - examples: - - name: BandwidthScheduleGetAllInDevice - text: |- - az databoxedge bandwidth-schedule list --device-name "testedgedevice" --resource-group \ -"GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule show'] = """ - type: command - short-summary: "Gets the properties of the specified bandwidth schedule." - examples: - - name: BandwidthScheduleGet - text: |- - az databoxedge bandwidth-schedule show --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule create'] = """ - type: command - short-summary: "Create a bandwidth schedule." - examples: - - name: BandwidthSchedulePut - text: |- - az databoxedge bandwidth-schedule create --name "bandwidth-1" --device-name "testedgedevice" --days \ -"Sunday" "Monday" --rate-in-mbps 100 --start "0:0:0" --stop "13:59:0" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule update'] = """ - type: command - short-summary: "Update a bandwidth schedule." -""" - -helps['databoxedge bandwidth-schedule delete'] = """ - type: command - short-summary: "Deletes the specified bandwidth schedule." - examples: - - name: BandwidthScheduleDelete - text: |- - az databoxedge bandwidth-schedule delete --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the databoxedge bandwidth-schedule is met. - examples: - - name: Pause executing next line of CLI script until the databoxedge bandwidth-schedule is successfully \ -created. - text: |- - az databoxedge bandwidth-schedule wait --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" --created - - name: Pause executing next line of CLI script until the databoxedge bandwidth-schedule is successfully \ -updated. - text: |- - az databoxedge bandwidth-schedule wait --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" --updated - - name: Pause executing next line of CLI script until the databoxedge bandwidth-schedule is successfully \ -deleted. - text: |- - az databoxedge bandwidth-schedule wait --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" --deleted -""" - -helps['databoxedge'] = """ - type: group - short-summary: Manage job with databoxedge -""" - -helps['databoxedge show-job'] = """ - type: command - short-summary: "Gets the details of a specified job on a Data Box Edge/Data Box Gateway device." - examples: - - name: JobsGet - text: |- - az databoxedge show-job --name "159a00c7-8543-4343-9435-263ac87df3bb" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge'] = """ - type: group - short-summary: Manage node with databoxedge -""" - -helps['databoxedge list-node'] = """ - type: command - short-summary: "Gets all the nodes currently configured under this Data Box Edge device." - examples: - - name: NodesGetAllInDevice - text: |- - az databoxedge list-node --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order'] = """ - type: group - short-summary: Manage order with databoxedge -""" - -helps['databoxedge order list'] = """ - type: command - short-summary: "Lists all the orders related to a Data Box Edge/Data Box Gateway device." - examples: - - name: OrderGetAllInDevice - text: |- - az databoxedge order list --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order show'] = """ - type: command - short-summary: "Gets a specific order by name." - examples: - - name: OrderGet - text: |- - az databoxedge order show --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order create'] = """ - type: command - short-summary: "Create an order." - examples: - - name: OrderPut - text: |- - az databoxedge order create --device-name "testedgedevice" --company-name "Microsoft" --contact-person \ -"John Mcclane" --email-list "john@microsoft.com" --phone "(800) 426-9400" --address-line1 "Microsoft Corporation" \ ---address-line2 "One Microsoft Way" --address-line3 "Redmond" --city "WA" --country "United States" --postal-code \ -"98052" --state "WA" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order update'] = """ - type: command - short-summary: "Update an order." -""" - -helps['databoxedge order delete'] = """ - type: command - short-summary: "Deletes the order related to the device." - examples: - - name: OrderDelete - text: |- - az databoxedge order delete --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the databoxedge order is met. - examples: - - name: Pause executing next line of CLI script until the databoxedge order is successfully created. - text: |- - az databoxedge order wait --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" \ ---created - - name: Pause executing next line of CLI script until the databoxedge order is successfully updated. - text: |- - az databoxedge order wait --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" \ ---updated - - name: Pause executing next line of CLI script until the databoxedge order is successfully deleted. - text: |- - az databoxedge order wait --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" \ ---deleted -""" - -helps['databoxedge'] = """ - type: group - short-summary: Manage sku with databoxedge -""" - -helps['databoxedge list-sku'] = """ - type: command - short-summary: "List all the available Skus in the region and information related to them." - examples: - - name: ListSkus - text: |- - az databoxedge list-sku -""" diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_params.py b/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_params.py deleted file mode 100644 index 2a15d7fcf25..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/_params.py +++ /dev/null @@ -1,227 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=line-too-long -# pylint: disable=too-many-lines -# pylint: disable=too-many-statements - -from azure.cli.core.commands.parameters import ( - tags_type, - get_enum_type, - resource_group_name_type, - get_location_type -) -from azure.cli.core.commands.validators import get_default_location_from_resource_group -from ..action import AddSku - - -def load_arguments(self, _): - - with self.argument_context('databoxedge device list') as c: - c.argument('resource_group_name', resource_group_name_type) - c.argument('expand', type=str, help='Specify $expand=details to populate additional fields related to the ' - 'resource or Specify `$skipToken=` to populate the next page in the list.') - - with self.argument_context('databoxedge device show') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge device create') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.') - c.argument('resource_group_name', resource_group_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('sku', action=AddSku, nargs='+', help='The SKU type.') - c.argument('etag', type=str, help='The etag for the devices.') - c.argument('data_box_edge_device_status', options_list=['--status'], arg_type=get_enum_type(['ReadyToSetup', - 'Online', - 'Offline', - 'NeedsAttention', - 'Disconnected', - 'PartiallyDisconnected', - 'Maintenance']), - help='The status of the Data Box Edge/Gateway device.') - c.argument('description', type=str, help='The Description of the Data Box Edge/Gateway device.') - c.argument('model_description', type=str, help='The description of the Data Box Edge/Gateway device model.') - c.argument('friendly_name', type=str, help='The Data Box Edge/Gateway device name.') - - with self.argument_context('databoxedge device update') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - c.argument('tags', tags_type) - - with self.argument_context('databoxedge device delete') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge device download-update') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge device install-update') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge device scan-for-update') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge device show-update-summary') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge device wait') as c: - c.argument('device_name', options_list=['--name', '-n', '--device-name'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge alert list') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge alert show') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('name', options_list=['--name', '-n'], type=str, help='The alert name.', id_part='child_name_1') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge bandwidth-schedule list') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge bandwidth-schedule show') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('name', options_list=['--name', '-n'], type=str, help='The bandwidth schedule name.', - id_part='child_name_1') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge bandwidth-schedule create') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.') - c.argument('name', options_list=['--name', '-n'], type=str, help='The bandwidth schedule name which needs to ' - 'be added/updated.') - c.argument('resource_group_name', resource_group_name_type) - c.argument('start', type=str, help='The start time of the schedule in UTC.') - c.argument('stop', type=str, help='The stop time of the schedule in UTC.') - c.argument('rate_in_mbps', type=int, help='The bandwidth rate in Mbps.') - c.argument('days', nargs='+', help='The days of the week when this schedule is applicable.') - - with self.argument_context('databoxedge bandwidth-schedule update') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('name', options_list=['--name', '-n'], type=str, help='The bandwidth schedule name which needs to ' - 'be added/updated.', id_part='child_name_1') - c.argument('resource_group_name', resource_group_name_type) - c.argument('start', type=str, help='The start time of the schedule in UTC.') - c.argument('stop', type=str, help='The stop time of the schedule in UTC.') - c.argument('rate_in_mbps', type=int, help='The bandwidth rate in Mbps.') - c.argument('days', nargs='+', help='The days of the week when this schedule is applicable.') - c.ignore('parameters') - - with self.argument_context('databoxedge bandwidth-schedule delete') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('name', options_list=['--name', '-n'], type=str, help='The bandwidth schedule name.', - id_part='child_name_1') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge bandwidth-schedule wait') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('name', options_list=['--name', '-n'], type=str, help='The bandwidth schedule name.', - id_part='child_name_1') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge show-job') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('name', options_list=['--name', '-n'], type=str, help='The job name.', id_part='child_name_1') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge list-node') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge order list') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge order show') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge order create') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, - help='The order details of a device.') - c.argument('resource_group_name', resource_group_name_type) - c.argument('status', arg_type=get_enum_type(['Untracked', 'AwaitingFulfilment', 'AwaitingPreparation', - 'AwaitingShipment', 'Shipped', 'Arriving', 'Delivered', - 'ReplacementRequested', 'LostDevice', 'Declined', - 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', - 'CollectedAtMicrosoft']), help='Status of the order as per the ' - 'allowed status types.', arg_group='Current Status') - c.argument('comments', type=str, help='Comments related to this status change.', arg_group='Current Status') - c.argument('address_line1', type=str, help='The address line1.', arg_group='Shipping Address') - c.argument('address_line2', type=str, help='The address line2.', arg_group='Shipping Address') - c.argument('address_line3', type=str, help='The address line3.', arg_group='Shipping Address') - c.argument('postal_code', type=str, help='The postal code.', arg_group='Shipping Address') - c.argument('city', type=str, help='The city name.', arg_group='Shipping Address') - c.argument('state', type=str, help='The state name.', arg_group='Shipping Address') - c.argument('country', type=str, help='The country name.', arg_group='Shipping Address') - c.argument('contact_person', type=str, help='The contact person name.', arg_group='Contact Information') - c.argument('company_name', type=str, help='The name of the company.', arg_group='Contact Information') - c.argument('phone', type=str, help='The phone number.', arg_group='Contact Information') - c.argument('email_list', nargs='+', help='The email list.', arg_group='Contact Information') - - with self.argument_context('databoxedge order update') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, - help='The order details of a device.', id_part='name') - c.argument('resource_group_name', resource_group_name_type) - c.argument('status', arg_type=get_enum_type(['Untracked', 'AwaitingFulfilment', 'AwaitingPreparation', - 'AwaitingShipment', 'Shipped', 'Arriving', 'Delivered', - 'ReplacementRequested', 'LostDevice', 'Declined', - 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', - 'CollectedAtMicrosoft']), help='Status of the order as per the ' - 'allowed status types.', arg_group='Current Status') - c.argument('comments', type=str, help='Comments related to this status change.', arg_group='Current Status') - c.argument('address_line1', type=str, help='The address line1.', arg_group='Shipping Address') - c.argument('address_line2', type=str, help='The address line2.', arg_group='Shipping Address') - c.argument('address_line3', type=str, help='The address line3.', arg_group='Shipping Address') - c.argument('postal_code', type=str, help='The postal code.', arg_group='Shipping Address') - c.argument('city', type=str, help='The city name.', arg_group='Shipping Address') - c.argument('state', type=str, help='The state name.', arg_group='Shipping Address') - c.argument('country', type=str, help='The country name.', arg_group='Shipping Address') - c.argument('contact_person', type=str, help='The contact person name.', arg_group='Contact Information') - c.argument('company_name', type=str, help='The name of the company.', arg_group='Contact Information') - c.argument('phone', type=str, help='The phone number.', arg_group='Contact Information') - c.argument('email_list', nargs='+', help='The email list.', arg_group='Contact Information') - c.ignore('order') - - with self.argument_context('databoxedge order delete') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge order wait') as c: - c.argument('device_name', options_list=['--device-name', '-d'], type=str, help='The device name.', - id_part='name') - c.argument('resource_group_name', resource_group_name_type) - - with self.argument_context('databoxedge list-sku') as c: - c.argument('filter_', options_list=['--filter'], type=str, help='Specify `$filter=\'location eq \'` to ' - 'filter on location.') diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/action.py b/src/azure-cli/azure/cli/command_modules/databoxedge/generated/action.py deleted file mode 100644 index 8d3f1c9dde7..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/action.py +++ /dev/null @@ -1,41 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=protected-access - -import argparse -from collections import defaultdict -from knack.util import CLIError - - -class AddSku(argparse.Action): - def __call__(self, parser, namespace, values, option_string=None): - action = self.get_action(values, option_string) - namespace.sku = action - - def get_action(self, values, option_string): # pylint: disable=no-self-use - try: - properties = defaultdict(list) - for (k, v) in (x.split('=', 1) for x in values): - properties[k].append(v) - properties = dict(properties) - except ValueError: - raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) - d = {} - for k in properties: - kl = k.lower() - v = properties[k] - if kl == 'name': - d['name'] = v[0] - elif kl == 'tier': - d['tier'] = v[0] - else: - raise CLIError('Unsupported Key {} is provided for parameter sku. All possible keys are: name, tier' - .format(k)) - return d diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/commands.py b/src/azure-cli/azure/cli/command_modules/databoxedge/generated/commands.py deleted file mode 100644 index 0897231eb1f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/commands.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. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-statements -# pylint: disable=too-many-locals - -from azure.cli.core.commands import CliCommandType - - -def load_command_table(self, _): - - from ..generated._client_factory import cf_device - databoxedge_device = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._devices_operations#DevicesOperations.{}', - client_factory=cf_device) - with self.command_group('databoxedge device', databoxedge_device, client_factory=cf_device, - min_api='2019-08-01') as g: - g.custom_command('list', 'databoxedge_device_list') - g.custom_show_command('show', 'databoxedge_device_show') - g.custom_command('create', 'databoxedge_device_create', supports_no_wait=True) - g.custom_command('update', 'databoxedge_device_update') - g.custom_command('delete', 'databoxedge_device_delete', supports_no_wait=True, confirmation=True) - g.custom_command('download-update', 'databoxedge_device_download_update', supports_no_wait=True) - g.custom_command('install-update', 'databoxedge_device_install_update', supports_no_wait=True) - g.custom_command('scan-for-update', 'databoxedge_device_scan_for_update', supports_no_wait=True) - g.custom_command('show-update-summary', 'databoxedge_device_show_update_summary') - g.custom_wait_command('wait', 'databoxedge_device_show') - - from ..generated._client_factory import cf_alert - databoxedge_alert = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._alerts_operations#AlertsOperations.{}', - client_factory=cf_alert) - with self.command_group('databoxedge alert', databoxedge_alert, client_factory=cf_alert, - min_api='2019-08-01') as g: - g.custom_command('list', 'databoxedge_alert_list') - g.custom_show_command('show', 'databoxedge_alert_show') - - from ..generated._client_factory import cf_bandwidth_schedule - databoxedge_bandwidth_schedule = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._bandwidth_schedules_operations#BandwidthSchedulesOperations' - '.{}', - client_factory=cf_bandwidth_schedule) - with self.command_group('databoxedge bandwidth-schedule', databoxedge_bandwidth_schedule, - client_factory=cf_bandwidth_schedule, min_api='2019-08-01') as g: - g.custom_command('list', 'databoxedge_bandwidth_schedule_list') - g.custom_show_command('show', 'databoxedge_bandwidth_schedule_show') - g.custom_command('create', 'databoxedge_bandwidth_schedule_create', supports_no_wait=True) - g.generic_update_command('update', custom_func_name='databoxedge_bandwidth_schedule_update', - supports_no_wait=True) - g.custom_command('delete', 'databoxedge_bandwidth_schedule_delete', supports_no_wait=True, confirmation=True) - g.custom_wait_command('wait', 'databoxedge_bandwidth_schedule_show') - - from ..generated._client_factory import cf_job - databoxedge_job = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._jobs_operations#JobsOperations.{}', - client_factory=cf_job) - with self.command_group('databoxedge', databoxedge_job, client_factory=cf_job, is_preview=True, - min_api='2019-08-01') as g: - g.custom_command('show-job', 'databoxedge_show_job') - - from ..generated._client_factory import cf_node - databoxedge_node = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._nodes_operations#NodesOperations.{}', - client_factory=cf_node) - with self.command_group('databoxedge', databoxedge_node, client_factory=cf_node, is_preview=True, - min_api='2019-08-01') as g: - g.custom_command('list-node', 'databoxedge_list_node') - - from ..generated._client_factory import cf_order - databoxedge_order = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._orders_operations#OrdersOperations.{}', - client_factory=cf_order) - with self.command_group('databoxedge order', databoxedge_order, client_factory=cf_order, - min_api='2019-08-01') as g: - g.custom_command('list', 'databoxedge_order_list') - g.custom_show_command('show', 'databoxedge_order_show') - g.custom_command('create', 'databoxedge_order_create', supports_no_wait=True) - g.generic_update_command('update', setter_arg_name='order', custom_func_name='databoxedge_order_update', - supports_no_wait=True) - g.custom_command('delete', 'databoxedge_order_delete', supports_no_wait=True, confirmation=True) - g.custom_wait_command('wait', 'databoxedge_order_show') - - from ..generated._client_factory import cf_sku - databoxedge_sku = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._skus_operations#SkusOperations.{}', - client_factory=cf_sku) - with self.command_group('databoxedge', databoxedge_sku, client_factory=cf_sku, is_preview=True, - min_api='2019-08-01') as g: - g.custom_command('list-sku', 'databoxedge_list_sku') diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/custom.py b/src/azure-cli/azure/cli/command_modules/databoxedge/generated/custom.py deleted file mode 100644 index cca81597efe..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/generated/custom.py +++ /dev/null @@ -1,331 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-lines -# pylint: disable=unused-argument - -from azure.cli.core.util import sdk_no_wait - - -def databoxedge_device_list(client, - resource_group_name=None, - expand=None): - if resource_group_name: - return client.list_by_resource_group(resource_group_name=resource_group_name, - expand=expand) - return client.list_by_subscription(expand=expand) - - -def databoxedge_device_show(client, - device_name, - resource_group_name): - return client.get(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_create(client, - device_name, - resource_group_name, - location, - tags=None, - sku=None, - etag=None, - data_box_edge_device_status=None, - description=None, - model_description=None, - friendly_name=None, - no_wait=False): - data_box_edge_device = {} - data_box_edge_device['location'] = location - data_box_edge_device['tags'] = tags - data_box_edge_device['sku'] = sku - data_box_edge_device['etag'] = etag - data_box_edge_device['data_box_edge_device_status'] = data_box_edge_device_status - data_box_edge_device['description'] = description - data_box_edge_device['model_description'] = model_description - data_box_edge_device['friendly_name'] = friendly_name - return sdk_no_wait(no_wait, - client.create_or_update, - device_name=device_name, - resource_group_name=resource_group_name, - data_box_edge_device=data_box_edge_device) - - -def databoxedge_device_update(client, - device_name, - resource_group_name, - tags=None): - return client.update(device_name=device_name, - resource_group_name=resource_group_name, - tags=tags) - - -def databoxedge_device_delete(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.delete, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_download_update(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.download_updates, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_install_update(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.install_updates, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_scan_for_update(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.scan_for_updates, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_show_update_summary(client, - device_name, - resource_group_name): - return client.get_update_summary(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_alert_list(client, - device_name, - resource_group_name): - return client.list_by_data_box_edge_device(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_alert_show(client, - device_name, - name, - resource_group_name): - return client.get(device_name=device_name, - name=name, - resource_group_name=resource_group_name) - - -def databoxedge_bandwidth_schedule_list(client, - device_name, - resource_group_name): - return client.list_by_data_box_edge_device(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_bandwidth_schedule_show(client, - device_name, - name, - resource_group_name): - return client.get(device_name=device_name, - name=name, - resource_group_name=resource_group_name) - - -def databoxedge_bandwidth_schedule_create(client, - device_name, - name, - resource_group_name, - start, - stop, - rate_in_mbps, - days, - no_wait=False): - parameters = {} - parameters['start'] = start - parameters['stop'] = stop - parameters['rate_in_mbps'] = rate_in_mbps - parameters['days'] = days - return sdk_no_wait(no_wait, - client.create_or_update, - device_name=device_name, - name=name, - resource_group_name=resource_group_name, - parameters=parameters) - - -def databoxedge_bandwidth_schedule_update(instance, - device_name, - name, - resource_group_name, - start, - stop, - rate_in_mbps, - days, - no_wait=False): - if start is not None: - instance.start = start - if stop is not None: - instance.stop = stop - if rate_in_mbps is not None: - instance.rate_in_mbps = rate_in_mbps - if days is not None: - instance.days = days - return instance - - -def databoxedge_bandwidth_schedule_delete(client, - device_name, - name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.delete, - device_name=device_name, - name=name, - resource_group_name=resource_group_name) - - -def databoxedge_show_job(client, - device_name, - name, - resource_group_name): - return client.get(device_name=device_name, - name=name, - resource_group_name=resource_group_name) - - -def databoxedge_list_node(client, - device_name, - resource_group_name): - return client.list_by_data_box_edge_device(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_order_list(client, - device_name, - resource_group_name): - return client.list_by_data_box_edge_device(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_order_show(client, - device_name, - resource_group_name): - return client.get(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_order_create(client, - device_name, - resource_group_name, - address_line1, - postal_code, - city, - state, - country, - contact_person, - company_name, - phone, - email_list, - status=None, - comments=None, - address_line2=None, - address_line3=None, - no_wait=False): - order = {} - order['current_status'] = {} - order['current_status']['status'] = status - order['current_status']['comments'] = comments - order['shipping_address'] = {} - order['shipping_address']['address_line1'] = address_line1 - order['shipping_address']['address_line2'] = address_line2 - order['shipping_address']['address_line3'] = address_line3 - order['shipping_address']['postal_code'] = postal_code - order['shipping_address']['city'] = city - order['shipping_address']['state'] = state - order['shipping_address']['country'] = country - order['contact_information'] = {} - order['contact_information']['contact_person'] = contact_person - order['contact_information']['company_name'] = company_name - order['contact_information']['phone'] = phone - order['contact_information']['email_list'] = email_list - return sdk_no_wait(no_wait, - client.create_or_update, - device_name=device_name, - resource_group_name=resource_group_name, - order=order) - - -def databoxedge_order_update(instance, - device_name, - resource_group_name, - status=None, - comments=None, - address_line1=None, - address_line2=None, - address_line3=None, - postal_code=None, - city=None, - state=None, - country=None, - contact_person=None, - company_name=None, - phone=None, - email_list=None, - no_wait=False): - if status is not None: - instance.current_status.status = status - if comments is not None: - instance.current_status.comments = comments - if address_line1 is not None: - instance.shipping_address.address_line1 = address_line1 - if address_line2 is not None: - instance.shipping_address.address_line2 = address_line2 - if address_line3 is not None: - instance.shipping_address.address_line3 = address_line3 - if postal_code is not None: - instance.shipping_address.postal_code = postal_code - if city is not None: - instance.shipping_address.city = city - if state is not None: - instance.shipping_address.state = state - if country is not None: - instance.shipping_address.country = country - if contact_person is not None: - instance.contact_information.contact_person = contact_person - if company_name is not None: - instance.contact_information.company_name = company_name - if phone is not None: - instance.contact_information.phone = phone - if email_list is not None: - instance.contact_information.email_list = email_list - return instance - - -def databoxedge_order_delete(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.delete, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_list_sku(client, - filter_=None): - return client.list(filter=filter_) diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/__init__.py b/src/azure-cli/azure/cli/command_modules/databoxedge/manual/__init__.py deleted file mode 100644 index c9cfdc73e77..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/_help.py b/src/azure-cli/azure/cli/command_modules/databoxedge/manual/_help.py deleted file mode 100644 index 0db4d305ee9..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/_help.py +++ /dev/null @@ -1,319 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (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. -# -------------------------------------------------------------------------- - -from knack.help_files import helps - - -helps['databoxedge'] = """ - type: group - short-summary: Support data box edge device and management -""" - -helps['databoxedge device'] = """ - type: group - short-summary: Manage device with databoxedge -""" - -helps['databoxedge device list'] = """ - type: command - short-summary: "Get all the Data Box Edge/Data Box Gateway devices in a resource group or in a subscription." - examples: - - name: Get all the Data Box Edge/Data Box Gateway devices in a resource group. - text: |- - az databoxedge device list --resource-group "GroupForEdgeAutomation" - - name: Get all the Data Box Edge/Data Box Gateway devices in a subscription. - text: |- - az databoxedge device list -""" - -helps['databoxedge device show'] = """ - type: command - short-summary: "Get the properties of the Data Box Edge/Data Box Gateway device." - examples: - - name: Get the properties of the Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge device show --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device create'] = """ - type: command - short-summary: "Create a Data Box Edge/Data Box Gateway resource." - examples: - - name: Create a Data Box Edge resource. - text: |- - az databoxedge device create --location "eastus" --sku "Edge" --name \ -"testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device update'] = """ - type: command - short-summary: "Modify a Data Box Edge/Data Box Gateway resource." - examples: - - name: Modify a Data Box Edge/Data Box Gateway resource. - text: |- - az databoxedge device update --name "testedgedevice" --tags Key1="value1" Key2="value2" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device delete'] = """ - type: command - short-summary: "Delete the Data Box Edge/Data Box Gateway device." - examples: - - name: Delete the Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge device delete --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device download-update'] = """ - type: command - short-summary: "Download the updates on a Data Box Edge/Data Box Gateway device." - examples: - - name: Download the updates on a Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge device download-update --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device install-update'] = """ - type: command - short-summary: "Install the updates on the Data Box Edge/Data Box Gateway device." - examples: - - name: Install the updates on the Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge device install-update --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device scan-for-update'] = """ - type: command - short-summary: "Scan for updates on a Data Box Edge/Data Box Gateway device." - examples: - - name: Scan for updates on a Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge device scan-for-update --name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge device show-update-summary'] = """ - type: command - short-summary: "Get information about the availability of updates based on the last scan of the device. It also \ -gets information about any ongoing download or install jobs on the device." - examples: - - name: Get update summary of the device. - text: |- - az databoxedge device show-update-summary --name "testedgedevice" --resource-group \ -"GroupForEdgeAutomation" -""" - -helps['databoxedge device wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the databoxedge device is met. - examples: - - name: Pause executing next line of CLI script until the databoxedge device is successfully created. - text: |- - az databoxedge device wait --name "testedgedevice" --resource-group "GroupForEdgeAutomation" --created - - name: Pause executing next line of CLI script until the databoxedge device is successfully deleted. - text: |- - az databoxedge device wait --name "testedgedevice" --resource-group "GroupForEdgeAutomation" --deleted -""" - -helps['databoxedge alert'] = """ - type: group - short-summary: Manage alert with databoxedge -""" - -helps['databoxedge alert list'] = """ - type: command - short-summary: "Get all the alerts for a Data Box Edge/Data Box Gateway device." - examples: - - name: Get all the alerts for a Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge alert list --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge alert show'] = """ - type: command - short-summary: "Get an alert by name." - examples: - - name: Get an alert by name. - text: |- - az databoxedge alert show --name "159a00c7-8543-4343-9435-263ac87df3bb" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule'] = """ - type: group - short-summary: Manage bandwidth schedule with databoxedge -""" - -helps['databoxedge bandwidth-schedule list'] = """ - type: command - short-summary: "Get all the bandwidth schedules for a Data Box Edge/Data Box Gateway device." - examples: - - name: Get all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge bandwidth-schedule list --device-name "testedgedevice" --resource-group \ -"GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule show'] = """ - type: command - short-summary: "Get the properties of the specified bandwidth schedule." - examples: - - name: Get the properties of the specified bandwidth schedule. - text: |- - az databoxedge bandwidth-schedule show --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule create'] = """ - type: command - short-summary: "Create a bandwidth schedule." - examples: - - name: Create a bandwidth schedule. - text: |- - az databoxedge bandwidth-schedule create --name "bandwidth-1" --device-name "testedgedevice" --days \ -"Sunday" "Monday" --rate-in-mbps 100 --start "0:0:0" --stop "13:59:0" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule update'] = """ - type: command - short-summary: "Update a bandwidth schedule." - examples: - - name: Update a bandwidth schedule. - text: az databoxedge bandwidth-schedule update --name "bandwidth-1" --device-name "testedgedevice" \ - --rate-in-mbps 150 --resource-group "GroupForEdgeAutomation" --start "0:0:0" --stop 12:00:00 --days Sunday -""" - -helps['databoxedge bandwidth-schedule delete'] = """ - type: command - short-summary: "Delete the specified bandwidth schedule." - examples: - - name: Delete the specified bandwidth schedule. - text: |- - az databoxedge bandwidth-schedule delete --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge bandwidth-schedule wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the databoxedge bandwidth-schedule is met. - examples: - - name: Pause executing next line of CLI script until the databoxedge bandwidth-schedule is successfully \ -created. - text: |- - az databoxedge bandwidth-schedule wait --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" --created - - name: Pause executing next line of CLI script until the databoxedge bandwidth-schedule is successfully \ -updated. - text: |- - az databoxedge bandwidth-schedule wait --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" --updated - - name: Pause executing next line of CLI script until the databoxedge bandwidth-schedule is successfully \ -deleted. - text: |- - az databoxedge bandwidth-schedule wait --name "bandwidth-1" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" --deleted -""" - -helps['databoxedge show-job'] = """ - type: command - short-summary: "Get the details of a specified job on a Data Box Edge/Data Box Gateway device." - examples: - - name: Get the details of a specified job on a Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge show-job --name "159a00c7-8543-4343-9435-263ac87df3bb" --device-name "testedgedevice" \ ---resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge list-node'] = """ - type: command - short-summary: "Get all the nodes currently configured under this Data Box Edge device." - examples: - - name: Get all the nodes currently configured under this Data Box Edge device. - text: |- - az databoxedge list-node --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order'] = """ - type: group - short-summary: Manage order with databoxedge -""" - -helps['databoxedge order list'] = """ - type: command - short-summary: "List all the orders related to a Data Box Edge/Data Box Gateway device." - examples: - - name: List all the orders related to a Data Box Edge/Data Box Gateway device. - text: |- - az databoxedge order list --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order show'] = """ - type: command - short-summary: "Get a specific order by name." - examples: - - name: Get a specific order by name. - text: |- - az databoxedge order show --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order create'] = """ - type: command - short-summary: "Create an order." - examples: - - name: Create an order. - text: |- - az databoxedge order create --device-name "testedgedevice" --company-name "Microsoft" --contact-person \ -"John Mcclane" --email-list "john@microsoft.com" --phone "(800) 426-9400" --address-line1 "Microsoft Corporation" \ ---address-line2 "One Microsoft Way" --address-line3 "Redmond" --city "WA" --country "United States" --postal-code \ -"98052" --state "WA" --status Untracked --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order update'] = """ - type: command - short-summary: "Update an order." - examples: - - name: Update an order - text: az databoxedge order update --phone "(800) 426-9432" -""" - -helps['databoxedge order delete'] = """ - type: command - short-summary: "Delete the order related to the device." - examples: - - name: Delete the order related to the device. - text: |- - az databoxedge order delete --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" -""" - -helps['databoxedge order wait'] = """ - type: command - short-summary: Place the CLI in a waiting state until a condition of the databoxedge order is met. - examples: - - name: Pause executing next line of CLI script until the databoxedge order is successfully created. - text: |- - az databoxedge order wait --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" \ ---created - - name: Pause executing next line of CLI script until the databoxedge order is successfully updated. - text: |- - az databoxedge order wait --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" \ ---updated - - name: Pause executing next line of CLI script until the databoxedge order is successfully deleted. - text: |- - az databoxedge order wait --device-name "testedgedevice" --resource-group "GroupForEdgeAutomation" \ ---deleted -""" - -helps['databoxedge list-sku'] = """ - type: command - short-summary: "List all the available Skus in the region and information related to them." - examples: - - name: List all the available Skus in the region and information related to them. - text: |- - az databoxedge list-sku -""" diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/_params.py b/src/azure-cli/azure/cli/command_modules/databoxedge/manual/_params.py deleted file mode 100644 index 6073d1602c8..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/_params.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 Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from azure.cli.core.commands.parameters import get_enum_type - - -def load_arguments(self, _): - with self.argument_context('databoxedge device create') as c: - t_sku_name, t_device_status = self.get_models('SkuName', 'DataBoxEdgeDeviceStatus') - c.argument('sku', help='The SKU type.', arg_type=get_enum_type(t_sku_name)) - c.argument('data_box_edge_device_status', options_list=['--status'], arg_type=get_enum_type(t_device_status), - help='The status of the Data Box Edge/Gateway device.') diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/commands.py b/src/azure-cli/azure/cli/command_modules/databoxedge/manual/commands.py deleted file mode 100644 index 21c4417fec0..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/commands.py +++ /dev/null @@ -1,35 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-statements -# pylint: disable=too-many-locals - -from azure.cli.core.commands import CliCommandType - - -def load_command_table(self, _): - - from ..generated._client_factory import cf_bandwidth_schedule - databoxedge_bandwidth_schedule = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._bandwidth_schedules_operations#BandwidthSchedulesOperations' - '.{}', - client_factory=cf_bandwidth_schedule) - with self.command_group('databoxedge bandwidth-schedule', databoxedge_bandwidth_schedule, - client_factory=cf_bandwidth_schedule, min_api='2019-08-01') as g: - g.generic_update_command('update', custom_func_name='databoxedge_bandwidth_schedule_update', - setter_name='begin_create_or_update', supports_no_wait=True) - - from ..generated._client_factory import cf_order - databoxedge_order = CliCommandType( - operations_tmpl='azure.mgmt.databoxedge.operations._orders_operations#OrdersOperations.{}', - client_factory=cf_order) - with self.command_group('databoxedge order', databoxedge_order, client_factory=cf_order, - min_api='2019-08-01') as g: - g.generic_update_command('update', setter_arg_name='order', custom_func_name='databoxedge_order_update', - setter_name='begin_create_or_update', supports_no_wait=True) diff --git a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/custom.py b/src/azure-cli/azure/cli/command_modules/databoxedge/manual/custom.py deleted file mode 100644 index b9690cb791f..00000000000 --- a/src/azure-cli/azure/cli/command_modules/databoxedge/manual/custom.py +++ /dev/null @@ -1,345 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=too-many-lines -# pylint: disable=unused-argument - -from azure.cli.core.util import sdk_no_wait -from azure.mgmt.databoxedge.models import Sku - - -def databoxedge_device_list(client, - resource_group_name=None, - expand=None): - if resource_group_name: - return client.list_by_resource_group(resource_group_name=resource_group_name, - expand=expand) - return client.list_by_subscription(expand=expand) - - -def databoxedge_device_show(client, - device_name, - resource_group_name): - return client.get(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_create(client, - device_name, - resource_group_name, - location, - tags=None, - sku=None, - etag=None, - data_box_edge_device_status=None, - description=None, - model_description=None, - friendly_name=None, - no_wait=False): - data_box_edge_device = {} - data_box_edge_device['location'] = location - if tags is not None: - data_box_edge_device['tags'] = tags - if sku is not None: - data_box_edge_device['sku'] = Sku(name=sku) - if etag is not None: - data_box_edge_device['etag'] = etag - if data_box_edge_device is not None: - data_box_edge_device['data_box_edge_device_status'] = data_box_edge_device_status - if description is not None: - data_box_edge_device['description'] = description - if model_description is not None: - data_box_edge_device['model_description'] = model_description - if friendly_name is not None: - data_box_edge_device['friendly_name'] = friendly_name - return sdk_no_wait(no_wait, - client.begin_create_or_update, - device_name=device_name, - resource_group_name=resource_group_name, - data_box_edge_device=data_box_edge_device) - - -def databoxedge_device_update(client, - device_name, - resource_group_name, - tags=None): - parameters = {} - if tags is not None: - parameters['tags'] = tags - return client.update(device_name=device_name, - resource_group_name=resource_group_name, - parameters=parameters) - - -def databoxedge_device_delete(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_download_update(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_download_updates, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_install_update(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_install_updates, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_scan_for_update(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_scan_for_updates, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_device_show_update_summary(client, - device_name, - resource_group_name): - return client.get_update_summary(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_alert_list(client, - device_name, - resource_group_name): - return client.list_by_data_box_edge_device(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_alert_show(client, - device_name, - name, - resource_group_name): - return client.get(device_name=device_name, - name=name, - resource_group_name=resource_group_name) - - -def databoxedge_bandwidth_schedule_list(client, - device_name, - resource_group_name): - return client.list_by_data_box_edge_device(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_bandwidth_schedule_show(client, - device_name, - name, - resource_group_name): - return client.get(device_name=device_name, - name=name, - resource_group_name=resource_group_name) - - -def databoxedge_bandwidth_schedule_create(client, - device_name, - name, - resource_group_name, - start, - stop, - rate_in_mbps, - days, - no_wait=False): - parameters = {} - parameters['start'] = start - parameters['stop'] = stop - parameters['rate_in_mbps'] = rate_in_mbps - parameters['days'] = days - return sdk_no_wait(no_wait, - client.begin_create_or_update, - device_name=device_name, - name=name, - resource_group_name=resource_group_name, - parameters=parameters) - - -def databoxedge_bandwidth_schedule_update(instance, - device_name, - name, - resource_group_name, - start, - stop, - rate_in_mbps, - days, - no_wait=False): - if start is not None: - instance.start = start - if stop is not None: - instance.stop = stop - if rate_in_mbps is not None: - instance.rate_in_mbps = rate_in_mbps - if days is not None: - instance.days = days - return instance - - -def databoxedge_bandwidth_schedule_delete(client, - device_name, - name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - device_name=device_name, - name=name, - resource_group_name=resource_group_name) - - -def databoxedge_show_job(client, - device_name, - name, - resource_group_name): - return client.get(device_name=device_name, - name=name, - resource_group_name=resource_group_name) - - -def databoxedge_list_node(client, - device_name, - resource_group_name): - return client.list_by_data_box_edge_device(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_order_list(client, - device_name, - resource_group_name): - return client.list_by_data_box_edge_device(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_order_show(client, - device_name, - resource_group_name): - return client.get(device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_order_create(client, - device_name, - resource_group_name, - address_line1, - postal_code, - city, - state, - country, - contact_person, - company_name, - phone, - email_list, - status, - comments=None, - address_line2=None, - address_line3=None, - no_wait=False): - order = {} - order['current_status'] = {} - order['current_status']['status'] = status - if comments is not None: - order['current_status']['comments'] = comments - order['shipping_address'] = {} - order['shipping_address']['address_line1'] = address_line1 - if address_line2 is not None: - order['shipping_address']['address_line2'] = address_line2 - if address_line3 is not None: - order['shipping_address']['address_line3'] = address_line3 - order['shipping_address']['postal_code'] = postal_code - order['shipping_address']['city'] = city - order['shipping_address']['state'] = state - order['shipping_address']['country'] = country - order['contact_information'] = {} - order['contact_information']['contact_person'] = contact_person - order['contact_information']['company_name'] = company_name - order['contact_information']['phone'] = phone - order['contact_information']['email_list'] = email_list - return sdk_no_wait(no_wait, - client.begin_create_or_update, - device_name=device_name, - resource_group_name=resource_group_name, - order=order) - - -def databoxedge_order_update(instance, - device_name, - resource_group_name, - status=None, - comments=None, - address_line1=None, - address_line2=None, - address_line3=None, - postal_code=None, - city=None, - state=None, - country=None, - contact_person=None, - company_name=None, - phone=None, - email_list=None, - no_wait=False): - if status is not None: - instance.current_status.status = status - if comments is not None: - instance.current_status.comments = comments - if address_line1 is not None: - instance.shipping_address.address_line1 = address_line1 - if address_line2 is not None: - instance.shipping_address.address_line2 = address_line2 - if address_line3 is not None: - instance.shipping_address.address_line3 = address_line3 - if postal_code is not None: - instance.shipping_address.postal_code = postal_code - if city is not None: - instance.shipping_address.city = city - if state is not None: - instance.shipping_address.state = state - if country is not None: - instance.shipping_address.country = country - if contact_person is not None: - instance.contact_information.contact_person = contact_person - if company_name is not None: - instance.contact_information.company_name = company_name - if phone is not None: - instance.contact_information.phone = phone - if email_list is not None: - instance.contact_information.email_list = email_list - return instance - - -def databoxedge_order_delete(client, - device_name, - resource_group_name, - no_wait=False): - return sdk_no_wait(no_wait, - client.begin_delete, - device_name=device_name, - resource_group_name=resource_group_name) - - -def databoxedge_list_sku(client, - filter_=None): - return client.list(filter=filter_) diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index 85963f46ecd..51c765baf41 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -35,7 +35,6 @@ azure-mgmt-containerregistry==14.1.0b1 azure-mgmt-containerservice==37.0.0 azure-mgmt-core==1.6.0 azure-mgmt-cosmosdb==9.8.0 -azure-mgmt-databoxedge==1.0.0 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==1.1.0b1 azure-mgmt-datamigration==10.0.0 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index 7d43ba46455..7fa35e1e7e4 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -35,7 +35,6 @@ azure-mgmt-containerregistry==14.1.0b1 azure-mgmt-containerservice==37.0.0 azure-mgmt-core==1.6.0 azure-mgmt-cosmosdb==9.8.0 -azure-mgmt-databoxedge==1.0.0 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==1.1.0b1 azure-mgmt-datamigration==10.0.0 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index 655cffaac2b..ca25b90cdec 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -35,7 +35,6 @@ azure-mgmt-containerregistry==14.1.0b1 azure-mgmt-containerservice==37.0.0 azure-mgmt-core==1.6.0 azure-mgmt-cosmosdb==9.8.0 -azure-mgmt-databoxedge==1.0.0 azure-mgmt-datalake-nspkg==3.0.1 azure-mgmt-datalake-store==1.1.0b1 azure-mgmt-datamigration==10.0.0 diff --git a/src/azure-cli/setup.py b/src/azure-cli/setup.py index 9cf36cf93c5..3e719a5f544 100644 --- a/src/azure-cli/setup.py +++ b/src/azure-cli/setup.py @@ -79,7 +79,6 @@ 'azure-mgmt-containerregistry==14.1.0b1', 'azure-mgmt-containerservice~=37.0.0', 'azure-mgmt-cosmosdb==9.8.0', - 'azure-mgmt-databoxedge~=1.0.0', 'azure-mgmt-datalake-store~=1.1.0b1', 'azure-mgmt-datamigration~=10.0.0', 'azure-mgmt-eventgrid==10.2.0b2',